Introduction to Testlib

If you are using C++ to create an algorithm competition problem, Testlib is an excellent auxiliary tool for writing related programs (generator, validator, checker, interactor). It is an essential tool for problem setters in Russia and some other countries, and is used in many competitions: ROI, ICPC regional contests, all Codeforces rounds...

The Testlib library consists of only a single file testlib.h. To use it, simply add #include "testlib.h" at the beginning of your program.

Specific uses of Testlib:

  • Writing a Generator, i.e., a data generator.
  • Writing a Validator, i.e., a data validator, to check whether the generated data meets the problem requirements, such as data range, format, etc.
  • Writing an Interactor, i.e., an interactor for interactive problems.
  • Writing a Checker, i.e., a Special Judge.

Testlib is fully compatible with the Polygon problem preparation platform developed by Codeforces.

testlib.h was ported from testlib.pas in 2005 and has been continuously updated. Testlib is compatible with most compilers, such as VC++ and GCC g++, and supports C++11.

This article is mainly translated from Testlib - Codeforces. The GitHub repository for testlib.h is MikeMirzayanov/testlib.