Introduction to Testlib

If you are using C++ to create an algorithmic 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 many competitions also use it: ROI, ICPC regional contests, all Codeforces ro...

The Testlib library consists of only one file, testlib.h; when using it, you only need to add #include "testlib.h" at the beginning of the program you write.

The specific uses of Testlib are:

  • Write a Generator, that is, a data generator.
  • Write a Validator, that is, a data validator, to determine whether generated data meets the problem requirements, such as data ranges and formats.
  • Write an Interactor, that is, an interactor for interactive problems.
  • Write a Checker, that is, a Special Judge.

Testlib is fully compatible with Polygon, the problem-setting platform developed by Codeforces.

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

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

This content comes from OI Wiki: Introduction to Testlib. See the original for authors and revision history. AIOJ has adapted the formatting, in-site links, and resource paths.

Content is shared under CC BY-SA 4.0 and SATA license; additional terms are governed by the original notice. Thanks to the OI Wiki authors and contributors; per the SATA terms, please visit the OI Wiki repository and star it to show your support.