By MikeMirzayanov, history, 4 years ago, translation, ,

Section about testlib is temporary, at some day it will be merged into global documentation section when it appears.

If you are developing a programming contest problem and you are doing it with using C++ then testlib.h is a right choice to write all axillary programs. This library is a standard solution in a professional community of problemsetters in Russia and several other countries. Many contests are prepared by using testlib.h: All-Russian school olympiads, ACM-ICPC regional contests, all Codeforces round and many others.

Recently testlib.h was moved onto GitHub, now it is available by the following link: https://github.com/MikeMirzayanov/testlib

testlib.h library is contained in a single header file. In order to include it you should just put testlib.h in the same directory with a program you are writing (checker, generator, validator or interactor) and just add a following line to the beginning of your program: #include "testlib.h".

Here are the cases when testlib.h is really useful:

• In writing generators. These are the programs that create tests for your problem, since it is not always possible to type a whole content of the test by using the keyboard (at least because of their possible large size);
• In writing validators. These are programs that read the whole test and verifies that it is correct and that it satisfies the constraints of the problem. Validators should be maximally strict with respect to spaces, endlines, leading zeroes etc;
• In writing interactors. These are programs that are used in interactive problems, if your problem isn't interactive then just nevermind;
• In writing checkers. If your problem allows several possible answers for the tests then you should write a special program that checks participant's answer against jury's answer and the input data.

testlib.h is fully compatible with Polygon problem preparation system.

First versions of testlib.h appeared in 2005 as a result of testlib.pas porting on C++. Since then testlib.h has evolved, its features and performance were improved. Last versions of testlib.h are compatible with different versions of Visual Studio compilers and GCC g++ (in editions for many platforms), also it is compatible with C++11.

Read more »

• +80