Overview
Quick Test CLI provides four specialized test modes, each designed for different testing scenarios in competitive programming. Choose the appropriate mode based on your testing requirements.Mode comparison
cmp
Compare your solution against a correct brute-force implementation
stress
Test execution time and performance without output comparison
check
Validate solutions with multiple correct answers using a custom checker
output
Generate output files for pre-existing test cases
cmp mode
Thecmp mode verifies the correctness of your solution by comparing it against a brute-force reference implementation. The reference solution should be correct but can be slower.
When to use
- You have a correct but slow brute-force solution
- You want to verify that your optimized solution produces the same output
- The problem has a unique correct answer
Required files
Usage example
Additional options
--diff flag
--diff flag
The
--diff or -d flag shows detailed differences between your output and the expected output when a wrong answer is detected.How it works
- Compiles both target and correct files
- Generates a test case (or loads from prefix)
- Runs both solutions with the same input
- Compares the outputs character by character
- Reports verdict: AC if outputs match, WA if they differ, or TLE/RTE/MLE if limits are exceeded
Both your target file and correct file must complete within the timeout limit. If the correct file exceeds the time limit, you’ll see a TLE message for the correct solution.
stress mode
Thestress mode focuses on performance testing by running your solution against multiple test cases without comparing outputs. It verifies that your code executes within time and memory limits.
When to use
- You want to test if your solution runs within time limits
- You don’t have a reference solution to compare against
- You’re testing for runtime errors or crashes
- You’re benchmarking performance across many test cases
Required files
Usage example
How it works
- Compiles the target file
- Generates test cases (or loads from prefix)
- Runs the solution and measures execution time and memory usage
- Reports verdict: AC if completed successfully within limits, TLE/RTE/MLE otherwise
check mode
Thecheck mode is designed for problems with multiple valid answers. Instead of comparing outputs directly, it uses a custom checker script to validate whether your solution’s output is acceptable.
When to use
- The problem has multiple correct answers (e.g., “find any valid solution”)
- Output format needs custom validation logic
- You need to verify constraints beyond exact string matching
- Problems asking for any permutation, any subset, or optimization with multiple optima
Required files
Usage example
Writing a checker
Your checker program should:- Read the test input from the generated test case
- Read the output produced by your target solution
- Validate whether the output is correct
- Exit with code 0 for correct answers, non-zero for wrong answers
Example checker (C++)
Example checker (C++)
How it works
- Compiles target file and checker file
- Generates a test case (or loads from prefix)
- Runs the target solution
- Runs the checker with access to both input and output
- Reports verdict based on checker’s exit code
The checker also has a timeout limit. If your checker is complex, make sure it runs efficiently.
output mode
Theoutput mode runs your solution against existing test cases and generates output files. This is useful for creating expected outputs or preparing submissions.
When to use
- You want to generate output files for a set of input files
- You need to create expected outputs for test cases
- You’re preparing files for manual verification
- You want to batch-process multiple input files
Required files
Usage example
File naming
Quick Test CLI looks for input files matching the pattern:{prefix}_1.in,{prefix}_2.in,{prefix}_3.in, …
--save-out, it creates output files:
{prefix}_1.out,{prefix}_2.out,{prefix}_3.out, …
Example file structure
Example file structure
Additional options
| Option | Description |
|---|---|
--save-out | Save the output for each test case to a .out file |
--break-bad | Stop execution if TLE or RTE occurs |
How it works
- Compiles the target file
- Finds all input files matching the prefix pattern
- Runs the solution for each input file
- Optionally saves outputs to corresponding
.outfiles - Reports execution status for each test case
Choosing the right mode
Use this decision tree to select the appropriate test mode:Overview
Learn about Quick Test CLI’s core architecture
Usage examples
See detailed usage examples for each mode