Skip to main content

Overview

Quick Test CLI supports seven popular programming languages used in competitive programming. The tool automatically detects the language based on file extensions and handles compilation and execution appropriately.

Supported languages

C++

GNU C++17 with competitive programming flags

Python

Python 3 interpreter

Java

Java Development Kit

C

GNU GCC C11 compiler

Rust

Rust with popular competitive programming crates

Go

Go programming language

Kotlin

Kotlin JVM compiler

C++

File extensions

.hh, .hpp, .hxx, .h++, .cc, .cpp, .cxx, .c++

Language details

  • Standard: C++17
  • Compiler: g++ (GNU C++ Compiler)
  • Special flags: -DONLINE_JUDGE=1 is automatically added

Compilation and execution

Compilation:
g++ -std=c++17 -DONLINE_JUDGE=1 main.cpp -o .qt/main
Execution:
./.qt/main
The -DONLINE_JUDGE=1 flag allows you to use conditional compilation in your code:
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

Python

File extensions

.py

Language details

  • Version: Python 3
  • Interpreter: python (or python3 depending on system configuration)

Execution

python main.py
Python is an interpreted language, so no compilation step is required. Quick Test CLI runs your script directly.

Java

File extensions

.java

Language details

  • Compiler: javac
  • Runtime: java
  • Note: Your main class must match your filename

Compilation and execution

Compilation:
javac -d .qt/ Main.java
Execution:
java -cp .qt/ Main
For Java files, the class name must match the filename. For example, if your file is Main.java, your public class must be named Main.

C

File extensions

.h, .c

Language details

  • Standard: GNU C11
  • Compiler: gcc (GNU C Compiler)
  • Math library: Automatically linked with -lm

Compilation and execution

Compilation:
gcc -std=gnu11 -lm main.c -o .qt/main
Execution:
./.qt/main
The -lm flag links the math library, allowing you to use functions from <math.h> without additional configuration.

Rust

File extensions

.rs

Language details

  • Build tool: cargo
  • Edition: 2021
  • Pre-installed crates: proconio, num, rand, regex, num-bigint

Compilation and execution

Compilation:
cp main.rs ~/.quicktest/rust/src/main.rs && \
cargo build --release --quiet --manifest-path ~/.quicktest/rust/Cargo.toml && \
cp ~/.quicktest/rust/target/release/rust .qt/main
Execution:
./.qt/main

Available dependencies

Quick Test CLI automatically configures a Rust project at ~/.quicktest/rust/ with these dependencies:
[dependencies]
proconio = "0.4.3"
num = "0.4.0"
rand = { version = "0.8.5", features = ["small_rng"]}
regex = "1.5.5"
num-bigint = "0.4.3"
use proconio::input;
use num::BigInt;
use rand::Rng;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }
    
    // Use the dependencies
    println!("Read {} numbers", n);
}
Quick Test CLI initializes the Rust environment on first use. Subsequent compilations reuse the existing project for faster build times.

Go

File extensions

.go

Language details

  • Compiler: go
  • Build mode: Executable binary

Compilation and execution

Compilation:
cp main.go ~/.quicktest/go_mod/main.go && \
go build -buildmode=exe -o ./.qt/main ~/.quicktest/go_mod/main.go
Execution:
./.qt/main
Quick Test CLI copies your Go file to ~/.quicktest/go_mod/ before building to ensure a clean build environment.

Kotlin

File extensions

.kt

Language details

  • Compiler: kotlinc
  • Runtime: java
  • Output format: JAR file with runtime included

Compilation and execution

Compilation:
kotlinc main.kt -include-runtime -d .qt/main.jar
Execution:
java -jar .qt/main.jar
The -include-runtime flag bundles the Kotlin runtime with your compiled code, making the JAR file self-contained.

Language detection

Quick Test CLI automatically detects the programming language based on file extensions. You don’t need to specify the language explicitly.
1

Extension detection

The tool reads the file extension from your target file, correct file, generator file, or checker file.
2

Language mapping

The extension is mapped to one of the supported languages using the internal configuration.
3

Command selection

The appropriate compilation and execution commands are selected based on the detected language and operating system.
4

Automatic execution

Your code is compiled and executed using the correct toolchain.

Customizing compilation

You can customize C++ compilation settings using the setup command:
qt setup config --label=cpp.compile --value="g++ -std=c++20 -O2 -DONLINE_JUDGE=1 ${FILE_NAME}.cpp -o .qt/${FILE_NAME_BINARY}"
Customizing compilation commands requires understanding of the Quick Test CLI configuration system. Use with caution.

Prerequisites

Before using Quick Test CLI, ensure you have the necessary compilers and interpreters installed:
Quick Test CLI verifies that the required compiler/interpreter is installed before running tests. If a tool is missing, you’ll see an error message with installation instructions.You can manually check if a language is available:
# C++
g++ --help

# Python
python --version

# Java
java -version
javac -version

# C
gcc --help

# Rust
cargo --version

# Go
go version

# Kotlin
kotlinc -version

Next steps

Test modes

Learn about the different test modes available

Getting started

Install Quick Test CLI on your system

Build docs developers (and LLMs) love