preparing-tests

Generates testlib checkers, validators, and subtask-grouped test data for competitive programming problems.

1|Updated Sep 3, 2026
One-click install
npx skills add https://github.com/nudetiger/competitive-programming-problem-preparer --skill preparing-tests-nudetiger
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: preparing-tests
Source: https://github.com/nudetiger/competitive-programming-problem-preparer/tree/main/skills/preparing-tests
Command: npx skills add https://github.com/nudetiger/competitive-programming-problem-preparer --skill preparing-tests-nudetiger

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building a competitive programming test suite that is legal, reaches every declared bound, and separates subtasks by complexity is error-prone when done by hand. This Skill produces the full test-data contract — checker, validator, and generators — using testlib, so wrong or slower solutions fail and the intended solution passes. ## Core Features & Use Cases - Checker and Validator Authoring: Writes testlib-based checkers (stock like ncmp/wcmp/rcmp6 or custom with registerTestlibCmd) and validators driven by a generated constraints.h header, with per-subtask group branching. - Generator Families: Produces random, max-size, boundary, structured-adversarial, and hand-written generators, with test counts split by subtask point weights and ICPC/OI kill policies. - Subtask Separation Enforcement: Verifies empirically that weaker per-subtask solutions score zero on stronger groups and that every declared bound is attained by some test. - Use Case: Given a problem with subtasks g1 (N ≤ 1000, O(N²)) and g2 (N ≤ 10⁶, O(N)), generate a validator that enforces both bounds and a 50-file test suite where g2 tests reach N = 10⁶ so the O(N²) solution cannot leak points. ## Quick Start Ask the assistant to write the testlib validator, checker, and generators for the problem in the current directory and build the subtask-grouped test data.

Frequently Asked Questions about preparing-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a testlib validator for a Polygon problem?

Write files/validator.cpp using registerValidation(argc, argv), read input only through testlib functions like readInt and readEoln, and check every constraint with ensuref. Generate constraints.h first with python3 -m tools.gen_constraints_header, and branch per subtask on validator.group().

How do I generate test data with testlib generators?

Write generators using registerGen(argc, argv, 1) and opt<T> for parameters, making each a pure function of argv. Build families of random, max-size, boundary, structured-adversarial, and hand-written tests, splitting the total file count by subtask point percentage.

Which testlib checker should I use for unique answers?

Use a stock checker from testlib such as ncmp, wcmp, rcmp6, yesno, or lcmp when the answer is unique. Note that rcmp6 means 1e-6 absolute or relative error, not six significant digits. For multiple valid outputs, write a custom checker with registerTestlibCmd.

Why does my validator fail on Polygon with unknown group error?

Polygon returns numeric test-group names like "1" and "2" while local runs use names like "g1" and "g2". Normalize the group string before branching, mapping g1 to 1 and g2 to 2, so one validator file works both locally and on Polygon.

How do I make sure subtask tests separate solution complexities?

Include tests in each stronger subtask that exceed the practical limit of every weaker subtask algorithm, maxing all parameters that drive complexity. Then run each weaker per-subtask solution against all stronger-subtask tests and confirm it scores zero in those groups.

Can I copy testlib.h into my problem package?

No, never copy testlib.h into files/, solutions/, or generator folders. Sources only include it via #include "testlib.h", and the include path is resolved by running python3 -m tools.bootstrap_testlib, which clones or refreshes a cached checkout.