IORedir ======= Please refer to the document [IORedir Check Type](http://judge-hypex.readthedocs.io/en/latest/TestOJCompatible.html#ioredir-check-type) for how to package IORedir problems. Diagram ------- ![](https://i.imgur.com/4OETB1O.png) (*1) You can set the test program's `pipeout` to an `arbitrary file descriptor (e.g. 100)`, and also set the checker's `pipeout` to an `arbitrary file descriptor (e.g. 200)`. Write a loop in the checker to read `pipeout (e.g. 200)` until reaching EOF. The EOF indicates that the test program has closed the `pipeout file descriptor`, which means the test program has exited. Example 1 --------- [checker.cpp](https://gist.github.com/pzread/58ae42f7f51347e0b2d11acdc3715aee#file-check-cpp) [Json config](https://gist.github.com/pzread/58ae42f7f51347e0b2d11acdc3715aee#file-conf-json) [Problem package](https://github.com/pzread/judge/tree/master/tests/testdata/res) In this example, file descriptors of the test program are configured as: ``` 0 (standard input): Test input file. 1 (standard output): Pipe to the checker. ``` File descriptors of the checker are configured as: ``` 0 (standard input): Pipe from the test program. 2: Test answer file. ``` Therfore, checker can read the test program's output from its `stdin`, and read the answer from `file descriptor 2`. It will compare them, and if there is any difference, exits with -1 (wrong answer). If you are creating an interactive problem, be sure that both the test and checker use `setvbuf` to disable the output buffers. Otherwise the pipes could cause deadlock. Example 2 --------- TBD