Briefly about testlib.h

Revision en3, by KAN, 2022-07-07 20:44:13

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 auxiliary programs. This library is a standard solution in a professional community of problemsetters around the world. Many contests are prepared using testlib.h: All-Russian and International olympiads in Informatics, ICPC regional contests, all Codeforces round and many other competitions.

You can find testlib.h on GitHub.

testlib.h library is contained in a single header file. In order to use it you should just put testlib.h in the same directory with a program you are writing (checker, generator, validator, or interactor) and add the 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 they are compatible with C++20.

Tags testlib, testlib.h

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English KAN 2022-07-07 20:44:13 260
ru9 Russian KAN 2022-07-07 20:39:14 204
en2 English MikeMirzayanov 2015-06-08 22:09:26 20
en1 English Zlobober 2015-06-08 20:43:25 2335 Added English translation
ru8 Russian MikeMirzayanov 2015-06-08 01:29:17 0 (опубликовано)
ru7 Russian MikeMirzayanov 2015-06-08 01:21:37 7 Мелкая правка: 'h имеет поддержку' -> 'h имеет полную поддержку'
ru6 Russian MikeMirzayanov 2015-06-08 01:21:11 21
ru5 Russian MikeMirzayanov 2015-06-08 01:20:00 109
ru4 Russian MikeMirzayanov 2015-06-03 13:35:51 112
ru3 Russian MikeMirzayanov 2015-06-03 01:23:52 323
ru2 Russian MikeMirzayanov 2015-06-03 01:16:48 2 Мелкая правка: 'нии *генереторов* &md' -> 'нии *генераторов* &md'
ru1 Russian MikeMirzayanov 2015-06-03 01:15:54 1715 Первая редакция