hakam

Hakam (Problem solving judge)

Makefile CI Docs

Metrics Metrics

Why Hakam?

As a problem solver, sometimes you might have slow internet, and waiting until your submission get tested might take longer than expected, you might even refresh your page a lot of times.

so why not testing your solution locally before you submit it?

What does “Hakam” mean?

Hakam’s name derives from “حَكَم” which is an arabic word means judge, and it is pronounced as /ħakam/. but since there is no /ħ/ sound in english i just latinised the name as “Hakam”.

What languages does Hakam support?

Any language that supports stdin & stdout.

Install

git clone --depth 1 https://github.com/iahmadgad/hakam.git && cd hakam && make install

Hakamfile

Hakamfile is a json file Hakam uses to compile، execute, and then test your solution code.

Here is an example of a Hakamfile:

{
   "compile": "g++ solution.cpp",
   "execute": "./a.out",
   "tests":
   [
       ["8", "YES"],
       ["5", "NO"]
   ]
}

Usage

hakam [-h] {new,set,add,rm,test} ...

[-h, --help]

prints usage

set [-h] [-f, --filename FILENAME] [-c, --compile command] [-e, --execute command] [-t, --tests number]

add [-h] [-f, --filename FILENAME] [-c, --compile command] [-t, --tests number]

rm [-h] [-f, --filename FILENAME] [-c, --compile command] [-t, --test index]

test [-f, --filename FILENAME] [-s, --strict] [-v, --verbose]

$ hakam test
Compiling...
Testing...
Passed: 2
Wrong answers: 1

with --verbose:

$ hakam test --verbose
Compiling...
Testing...
1: Test Passed :)
2: Test Passed :)
3: Wrong Answer :^)
expected NO for input 2 not YES
Passed: 2
Wrong answers: 1

In case your code passed all the tests output should be something like this:

$ hakam test
Compiling...
Testing...
Accepted

with --verbose:

$ hakam test --verbose
Compiling...
Testing...
1: Test Passed :)
2: Test Passed :)
3: Test Passed :)
Accepted

In case your code answered wrong and you chose --strict option, Hakam won’t proceed to perform tests, and output should be something like this:

hakam test --strict
Compiling...
Testing...
1: Wrong Answer :^)
expected YES for input 8 not NO