gitmyhub

Checker

C++ ★ 0 updated 5y ago ⑂ fork

实用对拍器

What This Repo Does

Checker is a testing tool for competitive programmers who write code in C++. It automatically compares your program's output against a reference solution by running both on the same test cases, over and over. Instead of manually writing test data and checking answers by hand, Checker generates random test cases, runs your code and the correct solution side-by-side, and tells you instantly if they match or differ.

How It Works

You set up three C++ files: your own program (Main.cpp), a reference solution you know is correct (Std.cpp), and a data generator (Dmk.cpp) that creates random test inputs. You compile Checker, then run it from the command line. It automatically compiles your three files, generates a test case, runs both your program and the reference solution on it, and compares their outputs. It repeats this cycle continuously—you can stop it manually when you're confident your solution is correct. The tool handles tricky scenarios like floating-point answers (where exact matching isn't possible) and shows you execution times for each run, color-coded by speed.

Who Uses This and Why

This is designed for people in competitive programming contests (like Codeforces or ACM competitions) who need to verify their solutions work correctly. Writing test cases by hand is tedious and error-prone; Checker automates that. It's especially useful when the expected answer format is messy—floating-point numbers, multiple valid outputs, or custom judge rules—because it lets you plug in a "special judge" (a custom comparison function) instead of doing simple string matching. The tool runs on both Linux and Windows, making it accessible regardless of your platform.

Notable Design Choices

Checker relies on testlib.h, a popular testing library in competitive programming. The tool is configured through a C++ header file, which means changing settings requires recompiling the whole project—not ideal, but the developer acknowledges this and hints at future improvements. The README shows the author is actively maintaining it and open to contributions.