aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml4
-rw-r--r--README.md2
-rw-r--r--src/push_swap/push_swap.h2
-rw-r--r--src/push_swap/sort.c2
-rwxr-xr-xtest.sh25
6 files changed, 23 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 9ace9f3..b855eaf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ push_swap
*.ghc
*.dSYM
benchmark.json
+result.log
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..ad6a1dc
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: c
+compiler: gcc
+install: sudo apt install -y ruby
+script: make && sh ./test.sh --error && sh ./test.sh 100 10 1000
diff --git a/README.md b/README.md
index 94f8992..91259c3 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# push_swap
+# push_swap [![Build Status](https://api.travis-ci.com/HappyTramp/push_swap.svg?branch=master)](https://travis-ci.com/HappyTramp/push_swap)
push_swap project of school 42
diff --git a/src/push_swap/push_swap.h b/src/push_swap/push_swap.h
index 9426cca..0bffca5 100644
--- a/src/push_swap/push_swap.h
+++ b/src/push_swap/push_swap.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/19 09:10:11 by cacharle #+# #+# */
-/* Updated: 2020/01/21 10:20:04 by cacharle ### ########.fr */
+/* Updated: 2020/01/22 08:59:59 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
diff --git a/src/push_swap/sort.c b/src/push_swap/sort.c
index e1a9bca..c712d50 100644
--- a/src/push_swap/sort.c
+++ b/src/push_swap/sort.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/19 09:12:02 by cacharle #+# #+# */
-/* Updated: 2020/01/21 11:07:48 by cacharle ### ########.fr */
+/* Updated: 2020/01/22 08:55:55 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
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