Crates.io | stressed |
lib.rs | stressed |
version | 1.1.2 |
source | src |
created_at | 2023-10-01 22:42:47.645136 |
updated_at | 2023-12-30 15:34:14.580002 |
description | Universal CLI stress tester for competitive programming |
homepage | https://github.com/w3rew/stressed |
repository | https://github.com/w3rew/stressed |
max_upload_size | |
id | 989488 |
size | 116,010 |
Often when solving competitive programming problems they fail, and on a platform that doesn't let you see the test cases that can be a problem. However, often it's easy to test the solution on small testcases, where another (probably more naive and simple) solution is feasible. Then by combining sampler or generator, which generates small test cases randomly, and reference solver, broadly called checker, we can evaluate our solution and fix it. This project is aimed at providing flexible and fast tool to perform such testing.
For details on usage see the Usage section.
You can either compile from source using cargo or download the precompiled release files at Github releases. To install via cargo run
cargo install stressed
You need to have Rust toolchain, including cargo, to do so. The easier alternative is to use precompiled statically-linked binaries under the releases tab on Github. Those are built using Github Actions and you can inspect the build scripts yourself, so it's safe.
stressed --sampler ./generator.py --checker ./C.py ./c -n 1000 --diff-mode char
# Or shorter
stressed -s ./generator.py -c ./C.py ./c -n 1000 --diff-mode char
This command sets the number of iterations to 1000 and outputs diff per character.
Notice dots in ./generator.py
and other files: these are mandatory if using relative paths.
For other parameters please refer to CLI docs.
This is the executable to test. It should accepth the testcase via stdin and print the answer to stdout.
Sampler (or generator) should be an executable, which generator random tests and prints them to standard output. It can (optionally) take random seed as command line argument for reproducible runs; the seed will be printed in test synopsis on failure.
Usually checker is a brute force solution to the same problem. Its output is compared to the program character by character. However, for more complex needs you can use custom checker with arbitrary logic.
CLI arguments besides --use-custom-checker
are described in detail in CLI docs.
Briefly, you can control:
Custom checker should read both testcase and the checked solution from stdin, one by one without any additional delimiter other than newline. Then it should succeed (return zero exit code) if the solution fits the testcase, or fail (return non-zero exit code) if the solution is wrong for the testcase. Also it can output error message, which will be written in test synopsis.
To enable set --use-custom-checker
argument