| 1 | #!/usr/bin/env bash | 
| 2 |  | 
| 3 | mkdir -p bin | 
| 4 |  | 
| 5 | call_python() { | 
| 6 | python3 $@ || python $@ | 
| 7 | } | 
| 8 |  | 
| 9 | run() { | 
| 10 | call_python $@ | 
| 11 | code=$? | 
| 12 | if [ ${code} -ne 0 ] | 
| 13 | then | 
| 14 | echo -e "\033[91m\033[7mError in test '${1}'. Exiting...\033[0m" | 
| 15 | exit ${code} | 
| 16 | fi | 
| 17 | } | 
| 18 |  | 
| 19 | run_tests() { | 
| 20 | # Test prep (generate log files) | 
| 21 | echo -e "\033[93mUndergoing test preparations\033[0m" | 
| 22 | run ./tests/write.py ./bin/w1.lnm | 
| 23 | run ./tests/write_many.py ./bin/w2.lnm 100 | 
| 24 | echo | 
| 25 |  | 
| 26 | # Unit tests | 
| 27 | echo -e "\033[93mBeginning unit tests\033[0m" | 
| 28 | run ./tests/unit_parserargs.py | 
| 29 | echo | 
| 30 |  | 
| 31 | echo -e "\033[92mFinished! Exiting with code 0...\033[0m" | 
| 32 | } | 
| 33 |  | 
| 34 | run_tests | 
| 35 |  |