competester
A python cli tool to test competitive programming solutions(code) against multiple test cases and measure execution time.
This tool comes handy when the programmer is dealing with a problem having larger amount of test cases.
INSTALLATION
Install using pip
Linux (use pip if default version of python is 3.x on your distro):
sudo pip3 install --user --upgrade competest
Windows:
Run Powershell/cmd as admin and type:
pip install competest
Alternatively, Windows users can download the latest competest.exe file from releases.
DESCRIPTION & USAGE
competest is a command line program to test competitive coding problems for test cases. It requires python 3.6+ to be installed. It is licensed under GPL-v3 License.
As of now, supported Languages are:
- C
- C++
- java
- python
- pypy
- exe(i.e. compiled executables)
Usage:
competest [OPTIONS] [python|java|pypy|exe] PROGRAM_FILE
Example:
competest python program1.py -t tests.json
If the test case file has the same name as the program file, -t option can be omitted. competest will then look for a json or a txt file with the same name as the program file in the same folder as the program file. If test case file is not found, it will thow an Error
competest python program1.py
TEST CASES FORMAT
The test case file should contain all the test cases that you want to test your code against.
Note: The test case format is decided based on the file extension so the file
extension must be .txt or .json.
Test Cases can be written in 2 formats:
1. Test cases can be in .txt format
Single Test Case:
5
3 2 4 5 6
2
12
Note: input is followed by output and separated by a blank line.
Multiple Test Cases:
5
3 2 4 5 6
2
12
7
3 2 4 5 6 10 16
10
Note: Each test case is also separated by a blank line.
2. Test cases can also be in json format
Single Test Case:
[
{
"input":[
"5",
"3 2 4 5 6"
],
"output":[
"2",
"1 2"
]
}
]
Note: input and output are arrays of strings where each string is a line of input/output
Multiple Test Cases:
[
{
"input":[
"5",
"3 2 4 5 6"
],
"output":[
"2",
"1 2"
]
},
{
"input":[
"7",
"3 2 4 5 6 10 16"
],
"output":["10"]
}
]
OPTIONS
-t, --test-cases FILENAME File containing test cases.
-a, --compiler-args ARGUMENTS command line arguments to be passed to
compiler(for compiled languages only)
-h, --help Show this message and exit.
COMPILATION
You can pass extra arguments and flags to the compiler using -a option.
Don't pass -o flag to C/C++ compiler as it is not required and handled
by the tool itself.
The default compilation commands are:
Java
javac classname.java
C
gcc -O2 -lm filename.c
C++
g++ -O2 -lm filename.cpp
BUILD INSTRUCTIONS
To run competest directly use
python3 run.py
To run the tests use
python3 run_tests.py
To build competest binary (install pyinstaller first)
pyinstaller -F run.py
The executable will be saved in dist folder.
TODO
-
Add a simpler test case format - Improve Documentation
-
Add more metadata to setup.py - Add more language support
Made with ♥️ by Shailesh Aanand
Metadata
Release files for competest 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| competest-0.0.12.tar.gz | 20.1 kB | Without provenance | Details for competest-0.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| competest-0.0.12-py3-none-any.whl | Python 3 | none | any | Details for competest-0.0.12-py3-none-any.whl |
Total release size: 39.9 kB
Release files / competest-0.0.12.tar.gz
| Download URL | competest-0.0.12.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
349cb158f734a64eaa400abb361128b7e5c3e417dc6e224f6e60ab626af4ef2c
|
|
BLAKE2b-256 checksum How to use checksums |
8ff583683c8776138a060347c6b9df503cb8ccffebb8ae8c64a7017c8f101fae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.10
|
Release files / competest-0.0.12-py3-none-any.whl
| Download URL | competest-0.0.12-py3-none-any.whl |
|---|---|
| Size | 19.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bed5bc919722e763fd46a6cee84668350b12f8c8ea5057aa943420bb81c576c
|
|
BLAKE2b-256 checksum How to use checksums |
b27e911444d0ac34a3827be397bae5bacd7d926750151d677b15f323622e1e91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.10
|
Security for competest 0.0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.