toster 1.2.2

A simple-as-toast tester for C++ solutions to competitive programming exercises
# Toster
[![Crates.io](https://img.shields.io/crates/l/toster)](https://github.com/MikolajKolek/toster/blob/master/LICENSE)
[![Crates.io](https://img.shields.io/crates/d/toster)](https://crates.io/crates/toster)
[![Crates.io](https://img.shields.io/crates/v/toster)](https://crates.io/crates/toster)

A simple-as-toast tester for C++ solutions to competitive programming exercises

# Usage

```
Usage: toster [OPTIONS] <FILENAME>

Arguments:
  <FILENAME>  The name of the file containing the source code or the executable you want to test

Options:
  -i, --in <IN>
          Input directory [default: in]
      --in-ext <IN_EXT>
          Input file extension [default: .in]
  -o, --out <OUT>
          Output directory [default: out]
      --out-ext <OUT_EXT>
          Output file extension [default: .out]
      --io <IO>
          The input and output directory (sets both -i and -o at once)
  -c, --checker <CHECKER>
          The source code of a checker program written in C++ that verifies if the tested program's output is correct instead of comparing it with given output files
          The checker must use the following protocol:
          - The checker receives the contents of the input file and the output of the tested program on stdin, separated by a single "\n" character
          - The checker outputs "C" if the output is correct, or "I <OPTIONAL_DATA>" if the output is incorrect. The optional data can include any information useful for understanding why the output is wrong and will be shown when errors are displayed
  -t, --timeout <TIMEOUT>
          The number of seconds after which a test or generation (or checker if you're using the --checker flag) times out if the program does not return. WARNING: if you're using the sio2jail flag, this timeout will still work based on time measured directly by toster, not time measured by sio2jail [default: 5]
      --compile-timeout <COMPILE_TIMEOUT>
          The number of seconds after which compilation times out if it doesn't finish [default: 10]
      --compile-command <COMPILE_COMMAND>
          The command used to compile the file. <IN> gets replaced with the path to the source code file, <OUT> is the executable output location [default: "g++ -std=c++20 -O3 -static <IN> -o <OUT>"]
  -s, --sio2jail
          Makes toster use sio2jail for measuring program runtime and memory use more accurately. By default limits memory use to 1 GiB. WARNING: enabling this flag can significantly slow down testing
  -m, --memory-limit <MEMORY_LIMIT>
          Sets a memory limit (in KiB) for the executed program and enables the sio2jail flag. WARNING: enabling this flag can significantly slow down testing
  -g, --generate
          Makes toster generate output files in the output directory instead of comparing the program's output with the files in the output directory
  -h, --help
          Print help
  -V, --version
          Print version
```

# Compiler
If you're using the sio2jail feature and want to make sure that your toster measurements are exactly identical to those of sio2 on a contest, you need to make sure that you're using the same compiler version as the one used in sio. The compiler used in the [Polish Olympiad in Informatics](https://www.oi.edu.pl/) as of XXXI OI is G++ 12.2 (as detailed [here](https://www.oi.edu.pl/l/31oi_ustalenia_techniczne/)). If you want to install G++ 12.2, you can do so by building it from scratch (for example using [this](https://github.com/darrenjs/howto/blob/master/build_scripts/build_gcc_10.sh) script, only changing the version). You can also download prebuilt G++ versions made by me from here:
- [G++ 10.2](https://mikolajkolek.com/gcc-10.2)
- [G++ 12.2](https://mikolajkolek.com/gcc-12.2)

# License
Toster is licensed under the [MIT Licence](https://github.com/MikolajKolek/toster/blob/master/LICENSE)

# Dependencies
This project uses [sio2jail](https://github.com/sio2project/sio2jail), a project available under the MIT licence