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