Added primitive unit testing.

This commit is contained in:
Simon Brooke 2017-01-07 10:48:28 +00:00
parent 85cc542d74
commit 8026138b9c
8 changed files with 180 additions and 63 deletions

33
unit-tests.sh Executable file
View file

@ -0,0 +1,33 @@
#!/bin/bash
# Early stage unit test runner for post-scarcity software environment.
# Uses bash to run every file in the unit-tests subdirectory; expects these
# to return 0 on success, anything else on fail.
# (c) 2017 Simon Brooke <simon@journeyman.cc>
# Licensed under GPL version 2.0, or, at your option, any later version.
tests=0
pass=0
fail=0
for file in unit-tests/*
do
echo ${file}
bash ${file}
if [ $? -eq 0 ]
then
pass=$((${pass} + 1))
else
fail=$((${fail} + 1))
fi
tests=$((${tests} + 1))
done
echo
echo "Tested ${tests}, passed ${pass}, failed ${fail}"
exit ${fail}