aboutsummaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-01-22 09:00:32 +0100
committerCharles <sircharlesaze@gmail.com>2020-01-22 09:03:10 +0100
commit43304a35258b8720bad6eda609d3eae793b447f2 (patch)
tree40a6b769bcf8e20e368183cdb537e10b81462f8d /test.sh
parent4ffa37c11bf86fe429edfde166a991275639fd39 (diff)
downloadpush_swap-43304a35258b8720bad6eda609d3eae793b447f2.tar.gz
push_swap-43304a35258b8720bad6eda609d3eae793b447f2.tar.bz2
push_swap-43304a35258b8720bad6eda609d3eae793b447f2.zip
Added return status in test for travis-ci, Added .travis.yml
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh25
1 files changed, 15 insertions, 10 deletions
diff --git a/test.sh b/test.sh
index 6222850..ed16596 100755
--- a/test.sh
+++ b/test.sh
@@ -15,8 +15,11 @@ MIN_LONG=-9223372036854775808
MAX_LONG1=9223372036854775808
MIN_LONG1=-9223372036854775809
+test_status=0
+
red() {
echo -n "\033[31m$1\033[0m "
+ test_status=1
}
green() {
@@ -103,7 +106,7 @@ if [ $1 = "--error" ]; then
assert_error `./push_swap $MIN_LONG1 2>&1`
assert_error `./push_swap $MAX_LONG1 2>&1`
- exit
+ exit $test_status
fi
test_nb=$1
@@ -121,24 +124,26 @@ else
fi
for i in `seq 1 $test_nb`; do
- arg=`random_stack.rb $start $end`
- result=`push_swap $arg | ./checker $arg`
+ arg=`./random_stack.rb $start $end`
+ result=`./push_swap $arg | ./checker $arg`
case $result in
- OK)
- echo -n "\033[32m.\033[0m"
+ "OK")
+ green "\033[32m.\033[0m"
;;
- KO)
- echo -n "\033[31m!\033[0m"
+ "KO")
+ red "\033[31m!\033[0m"
echo "Test $i failed with: $arg" >> result.log
;;
- Error)
- echo -n "\033[31m!\033[0m"
+ "Error")
+ red "\033[31m!\033[0m"
echo "Test $i failed due to parsing error with: $arg" >> result.log
;;
*)
- echo "Unexpected output"
+ red "Unexpected output"
exit
;;
esac
done
+
+exit $test_status