Add test stage to CI.
This commit is contained in:
parent
c9293d4132
commit
e515f72228
@ -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
|
||||
|
28
test.sh
Executable file
28
test.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user