https://github.com/mzuenni/pyctd
native python implementation of Checktestdata
https://github.com/mzuenni/pyctd
acm-icpc domjudge grammar icpc programming-contests syntax-checker testdata validation verify
Last synced: 6 days ago
JSON representation
native python implementation of Checktestdata
- Host: GitHub
- URL: https://github.com/mzuenni/pyctd
- Owner: mzuenni
- License: gpl-3.0
- Created: 2026-02-25T14:08:26.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-03-25T17:41:53.000Z (13 days ago)
- Last Synced: 2026-03-25T17:51:08.194Z (13 days ago)
- Topics: acm-icpc, domjudge, grammar, icpc, programming-contests, syntax-checker, testdata, validation, verify
- Language: Python
- Homepage:
- Size: 1.44 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python Checktestdata
> Checktestdata is a tool to verify the syntactical integrity of test cases in programming contests like the ACM ICPC.
> It allows you to specify a simple grammar for your testdata input files, according to which the testdata is checked.
>
> — [Checktestdata](https://github.com/DOMjudge/checktestdata)
This is a Python 3.10 compatible reimplementation of the checktestdata program.
> [!NOTE]
> As of now, the python implementation only supports strict file validation. The arguments `whitespace-ok` and `generate` are not supported.
## Documentation
* [Introduction to the Checktestdata Language](doc/introduction.md).
* The [CTD language specification](https://github.com/DOMjudge/checktestdata/blob/main/doc/format-spec.md) at the
[DOMjudge Checktestdata repository](https://github.com/DOMjudge/checktestdata).
* [The Regex Syntax](doc/regex.md).
## Installation
Requirements:
* PyPy >= v7.3.15 (preferred)
* CPython >= 3.10 (alternative)
The package can be installed directly from [pypi](https://pypi.org/project/checktestdata/):
```
pypy3 -m ensurepip
pypy3 -m pip install checktestdata
```
```
pip install checktestdata
```
## Use
You can use this program to run `.ctd` validators in the same way as the checktestdata binary:
```
pyctd validator.ctd [-d | --debug] < testcase
```
You can also use the programm to convert `.ctd` files into standalone python applications:
```
pyctd validator.ctd --convert [name] [-d | --debug]
```
> [!TIP]
> The generated validator might not be easy to read, cosider adding `-d` to include the original code as comments.
## Extensions
This checktesdata implementation supports the `--constraints_file` argument and can be used with [BAPCtools](https://github.com/RagnarGrootKoerkamp/BAPCtools) to check the constraints of a problem.