#!/usr/bin/env bash mkdir -p bin py() { python3 $@ } success() { echo -e "\033[92m\033[1m\033[7m${@}\033[0m" } success_lite() { echo -e "\033[92m${@}\033[0m" } error() { echo -e "\033[91m\033[7m\033[1m${@}\033[0m" } warn() { echo -e "\033[93m\033[1m\033[7m${@}\033[0m" } warn_lite() { echo -e "\033[93m${@}\033[0m" } run() { warn_lite "python3 ${@}" py $@ code=$? if [ ${code} -ne 0 ] then error "Error in test '${@}'. Exiting..." exit ${code} else success_lite "Success in test '${@}'." fi echo } run_tests() { # Test prep (generate log files) warn "Undergoing test preparations" run ./tests/write.py ./bin/w1.lnm run ./tests/write_many.py ./bin/w2.lnm 100 echo # Unit tests warn "Beginning unit tests" run ./tests/unit_parserargs.py echo success "Finished! Exiting with code 0" } run_tests echo -e "Time elapsed: ${SECONDS} second(s)"