Quick unit testing CLI tool for competitive programming.
$ getac -h
Usage: getac [options] <file>
OPTIONS:
-t, --test=<file>
Specify a file to read test cases. (Default: <file>.txt)
-f, --filetype=<type>
File type to test. The default will be detected by the file extension.
-T, --timeout=<seconds>
Time limit for each test cases. (Default: 2)
--disable-colors
Turn off colors.
-F, --no-fail-fast
Don't quit when a failure.
-V, --version
Print version.
-h, --help
Show help.
# Run with the default Python
$ getac main.py
# Specify test cases
$ getac -t test-cases.in main.py
# Run with PyPy3
$ getac -f pypy3 main.py
Install Homebrew if not already installed.
$ brew tap fukamachi/getac
$ brew install getac
Install SBCL if not already installed.
$ git clone https://github.com/fukamachi/getac
$ cd getac
$ make
$ sudo make install
- Write your code in a file (ex.
main.py
)
a = int(input())
b, c = map(int, input().split())
s = input()
print(a + b + c, s)
- Write your test cases in "*.txt" (ex.
main.txt
)
==== example1 ====
1
2 3
test
--------------
6 test
==== example2 ====
2
3 4
myonmyon
-------
9 myonmyon
See Format of test cases for getting its syntax.
- Run
getac main.py
If some test cases are failed, it shows 'WA' (wrong answer).
Let's start with this very minimal example which contains a single test case:
Input texts are here...
------------------
Expected result is here...
The input text and its expected results are separated with ----
(more than 4 hyphens).
When you include multiple test cases in the same file, those have to be divided with ====
(more than 4 equal signs).
Input texts are here...
------------------
Expected result is here...
==================
Second test case
------------------
Expected result is here again...
The name of each test cases can be written in the middle of separators, like ==== example1 ====
.
Here's the full example:
==== example1 ====
Input texts are here...
------------------
Expected result is here...
==== example2 ====
Second test case
------------------
Expected result is here again...
If the single test file couldn't find, getac tries to get from ./test/
and ./tests/
directory, which contains test cases as separated input/output files.
The directory structure is like this:
.
├── main.lisp
└── tests
├── sample-1.in
├── sample-1.out
├── sample-2.in
└── sample-2.out
- C
- C++
- Clojure
- Common Lisp
- Go
- Haskell
- Java
- Node.js
- Python
- Ruby
- Scheme
- Eitaro Fukamachi (e.arrows@gmail.com)
Copyright (c) 2019 Eitaro Fukamachi (e.arrows@gmail.com)
See LICENSE.