Automatically compile and test command line programs on the fly.
When solving algorithmic problems, you need to continuously compile and input test cases to determine whether the output results are correct. This product can help you automate these processes, you only need to write code.
-
According to your own system, download the latest binary file from https://github.com/117503445/oj/releases/latest and add folder to the system
path
environment variable. -
input
oj
in terminal, showNo Source Code found in the dir.
. -
According to your needs, install gcc, g++, python, and make sure it is accessible in the terminal.
We recommend that you use vscode and enable auto-save.
-
We assume that you write cpp code in ~/mydir/main.cpp.
#include <iostream> using namespace std; int main(int argc, char const *argv[]) { cout << "start\n"; int a, b; cin >> a >> b; cout << "a = " << a << endl; cout << "b = " << b << endl; cout << a + b; cout << "\nend"; return 0; }
-
write input test file.
~/mydir/1.in
1 2
~/mydir/2.in
2 3
-
run
oj
in~/mydir
-
When
main.cpp
changes,oj
will automatically compilemain.cpp
, redirect1.in
and2.in
as test cases from standard input to a binary file, and save the output to1.main.out
and2.main.out
.
install golang v1.22
go run /workspace/cmd/oj
There are some test code in ./assets dir.
Distributed under The GNU General Public License v3.0, See LICENSE
for more information.