| 1 | #!/usr/bin/env bash |
| 2 |
|
| 3 | mkdir -p bin |
| 4 |
|
| 5 | py() { |
| 6 | python3 $@ |
| 7 | } |
| 8 |
|
| 9 | good() { |
| 10 | echo -e "\033[92m${1}\033[0m" |
| 11 | } |
| 12 |
|
| 13 | bad() { |
| 14 | echo -e "\033[91m\033[7m${1}\033[0m" |
| 15 | } |
| 16 |
|
| 17 | warn() { |
| 18 | echo -e "\033[93m${1}\033[0m" |
| 19 | } |
| 20 |
|
| 21 | run() { |
| 22 | py $@ |
| 23 | code=$? |
| 24 | if [ ${code} -ne 0 ] |
| 25 | then |
| 26 | bad "Error in test '${@}'. Exiting..." |
| 27 | exit ${code} |
| 28 | fi |
| 29 | } |
| 30 |
|
| 31 | run_tests() { |
| 32 | # Test prep (generate log files) |
| 33 | warn "Undergoing test preparations" |
| 34 | run ./tests/write.py ./bin/w1.lnm |
| 35 | run ./tests/write_many.py ./bin/w2.lnm 100 |
| 36 | echo |
| 37 |
|
| 38 | # Unit tests |
| 39 | warn "Beginning unit tests" |
| 40 | run ./tests/unit_parserargs.py |
| 41 | echo |
| 42 |
|
| 43 | good "Finished! Exiting with code 0..." |
| 44 | } |
| 45 |
|
| 46 | run_tests |
| 47 |
|