Show HN: Turn testing into your winning edge in programming contests

4 months ago 9

⚖️ Turn testing into your winning edge!

Version Number GitHub Actions Status Static Badge

Say goodbye to annoying manual test runs during an intense programming contest!

Umpire is a blazingly fast command-line helper that compiles your code, executes it, and automatically validates against all test cases.

With just one short command, you can get quick, clear, and easy-to-read results at a glance. It lets you focus on solving problems rather than wasting time juggling with annoying copy-pastes and loads of commands.

Umpire turns testing into your winning edge!

Demo Video

📥 Installation (Linux and MacOS)

Umpire is available for both Linux and MacOS.

Note

To avoid large package size, please install the compilers that you use:

gcc # C++, installed by default python3 # Python go # Golang zulu # Java rustc # Rust
Click here to see the installation guide
Umpire is available via Nix flakes. Please enable Nix flakes for your system (here is the doc that explains how to enable it: NixOS Wiki).
  1. Add the url to your flake.nix input:
inputs = { umpire.url = "github:udontur/umpire"; # ... };
  1. Add the package in environment.systemPackages:
environment.systemPackages = with pkgs; [ inputs.umpire.packages."${system}".default # ... ];
  1. Rebuild your configuration with Nix flakes enabled.
sudo nixos-rebuild switch --flake /PATH/TO/CONFIG#WORKSTATION_NAME

Use an AUR helper of your choice to get Umpire (like yay and paru):

Run the following command in your terminal:

git clone https://github.com/udontur/umpire && cd umpire && sudo chmod +x asset/install.sh && asset/install.sh

See the detailed explaination.

The usage guide is also available via the following command: um --help

Organize your code directory as follows:

task-a # The folder that stores everything └─ main.cpp # File name must be "main"   └─ testcase # Exact name    ├─ ABC.in # Same input / output name: ABC    ├─ ABC.out # Same input / output name: ABC
Click here for more details
task-a is the directory that contains the code file and test case folder.

The code file should be named as main.XXX where XXX is the file extension (.cpp for C++).

The test cases should be located in the testcase folder (must be the exact name).

Each test case in the folder must be in the format of ABC.in and ABC.out where ABC is the input / output file name.

Run umpire in the current directory:

Or specify a directory:

Note

For Java programmers, make sure the class name is main.

Set the execution time limit in seconds (accepts integers and decimal numbers):

um -t 3.5 # 3.5 seconds time limit

Tip

Omit for a 1 second time limit

Run the code located in the task-a folder with a 2 second time limit:

Read Entire Article