diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9493dec..ec327fa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: "rust:latest" stages: - build + - test build-job: stage: build @@ -10,3 +11,8 @@ build-job: - target/release/indivisible script: - cargo build --release + +test-job: + stage: test + script: + - ./test.sh diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..7761095 --- /dev/null +++ b/test.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +echo -n "Prime finding..." +if [[ $(./target/release/indivisible 5) == 11 ]] +then + echo " pass" +else + echo " FAIL" + exit 1 +fi + +echo -n "Positive prime test..." +if ./target/release/indivisible -t 11 +then + echo " pass" +else + echo " FAIL" + exit 1 +fi + +echo -n "Negative prime test..." +if ! ./target/release/indivisible -t 9 +then + echo " pass" +else + echo " FAIL" + exit 1 +fi