Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

[Tool] dsastress: A Rust-based CLI for Stress Testing & Minimizing Failing Cases

Правка en2, от SaucyFries69, 2026-04-22 22:23:51

Hello Codeforces!

We’ve all been there: your solution passes the sample tests, but you get Wrong Answer on Test 4. You know there’s a bug, but the system test cases are huge and impossible to debug by hand.

I’ve created a small, high-performance CLI tool called dsastress to automate the classic stress-testing workflow.

What is dsastress?

It’s a Rust-based tool that repeatedly runs a generator, compares your solution against a brute-force (reference) implementation, and stops the moment it finds a mismatch.

Key Features:

Language Agnostic: Works with Python, C++, Rust, Java, or any CLI-executable.

Automatic Minimization: Uses a ddmin-style algorithm to shrink a giant failing input into the smallest possible "repro" case.

Reproducible Seeds: Passes DSASTRESS_SEED to your generator so you can recreate specific failures.

Artifact Saving: Automatically saves input.txt, expected.txt, and got.txt into folders for easy debugging.

Quick Start If you have Rust installed, you can install it directly from the source:

Bash

cargo install --path .

(Or soon via crates.io)

How to use it

Suppose you have a generator gen.py, a slow-but-correct brute.py, and your fast sol.cpp.

Bash

dsastress \
  --generator "./gen" \
  --solution "./sol" \
  --reference "python3 brute.py" \
  --tests 1000 \
  --minimize \
  --save-dir failing_cases

If a mismatch is found, dsastress will try to remove lines or tokens from the input to find the simplest version that still fails. This makes "Wrong Answer" on a graph with 10^5 nodes turn into a failure on a graph with only 4 nodes.

Reproducible Generators To make your tests reproducible, you can use the environment variables exported by the tool:

Python

import os, random
seed = int(os.environ.get("DSASTRESS_SEED", "0"))
test_idx = int(os.environ.get("DSASTRESS_TEST", "0"))
random.seed(seed ^ test_idx)

Call for Contributions

The tool is currently stable and ready for daily use in contests, but I’d love to see it grow. If you have ideas for:

  • Better TUI/Terminal progress bars.
  • Parallel execution support.
  • More aggressive minimization strategies.

Please feel free to contribute!

GitHub: 0xmuon/dsastress

Crates.io: dsastress

Good luck and high ratings to all!

Теги stress test, stress, dsa, algorithms, test, tool, cli, data structures

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский SaucyFries69 2026-04-22 22:23:51 102 v0.1.1
en1 Английский SaucyFries69 2026-04-22 22:21:50 2508 v0.1.1 (published)