Skip to content

Commit

Permalink
Add initial tests, adjust Travis CI setup, add Codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Konovalov authored and DominikBernhardt committed Nov 28, 2018
1 parent cc4927c commit b500d26
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ compiler:

# temporary hack with sed until we will have a proper configure script
script:
- set -e
- sed -i 's|TOPDIR=/path/to/the/directory/containing/this/makefile|TOPDIR=/home/travis/build/lbfm-rwth/carat|g' Makefile
- sed -i 's|CFLAGS = -g -Wall -DDIAG1|CFLAGS = --coverage -g -Wall -DDIAG1|g' Makefile
- make
- cd bin; ln -s `ls -d */` carat
- cd ../tst; ./run_all.sh

after_script:
- gcov functions/*/*.c
- bash <(curl -s https://codecov.io/bash)
19 changes: 19 additions & 0 deletions tst/Bravais.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#1
3d0 % invariant matrix
1
#g3 f1 % bravais group to grp1.dat
3 % generator
0 0 1
-1 0 0
0 1 0
3 % generator
1 0 0
0 0 1
0 1 0
3 % generator
1 0 0
0 -1 0
0 0 1
3d0 % invariant form
1
2^4 * 3^1 = 48 % order of the group
11 changes: 11 additions & 0 deletions tst/Bravais.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is a CARAT test file. It must have extension `.tst`.
# Comments and blank lines are ignored. For a test file named
# `testfile.tst`, the correct output of `bash testfile.tst`
# must be placed in the file `testfile.out`.

# Testing Form_space
../bin/carat/Form_space grp1.dat

# Testing Bravais_grp
../bin/carat/Bravais_grp grp1.dat

1 change: 1 addition & 0 deletions tst/Order.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The order of the group is 24
1 change: 1 addition & 0 deletions tst/Order.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../bin/carat/Order grp1.dat
24 changes: 24 additions & 0 deletions tst/Presentation.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
23x9 % presentation for group in grp1.dat
1 1 0 0 0 0 0 0 0
4 4 0 0 0 0 0 0 0
2 2 0 0 0 0 0 0 0
2 -1 2 -1 0 0 0 0 0
2 3 -1 -3 0 0 0 0 0
4 -3 4 -3 0 0 0 0 0
1 4 -1 -4 0 0 0 0 0
2 -1 -2 1 0 0 0 0 0
-4 3 4 3 0 0 0 0 0
1 3 -2 1 -3 0 0 0 0
2 4 -2 1 -4 0 0 0 0
3 4 -3 -3 4 0 0 0 0
1 3 1 -2 -3 0 0 0 0
2 4 1 -2 -4 0 0 0 0
3 -4 -3 -3 4 0 0 0 0
2 -4 2 4 -1 0 0 0 0
2 -4 3 2 -3 4 0 0 0
3 4 2 -3 -3 4 -1 0 0
3 3 2 -3 -3 4 -1 -4 0
4 3 2 -3 -3 4 -1 -3 0
2 3 4 -2 1 -3 -3 4 -1
1 3 4 -1 -2 1 -3 -3 4
-2 1 -1 2 0 0 0 0 0
1 change: 1 addition & 0 deletions tst/Presentation.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../bin/carat/Presentation grp1.dat
17 changes: 17 additions & 0 deletions tst/grp1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#4
3
-1 0 0
0 -1 0
0 0 1
3
-1 0 0
0 1 0
0 0 -1
3
0 1 0
0 0 1
1 0 0
3
0 1 0
1 0 0
0 0 1
27 changes: 27 additions & 0 deletions tst/run_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Inspired by `tst/testspecial/run_all.sh` from GAP
# (see https://github.com/gap-system/gap/)
#
# CARAT test files must have extension `.tst`.
# Comments and blank lines are ignored. For a test file named
# `testfile.tst`, the correct output of `bash testfile.tst`
# must be placed in the file `testfile.out`.
#
# This script iterates over all `*.tst` files, running each test
# and comparing its observed and expected output.
#
set -e
retvalue=0
for testfile in *.tst; do
echo "### Testing ${testfile}"
name="$(basename -s .tst ${testfile})"
bash -e "./${name}.tst" > "${name}.tmp" 2>&1
if ! diff -b "${name}.out" "${name}.tmp"; then
echo "${testfile} failed, see observed/expected output above"
retvalue=1
else
rm -f "${name}.tmp"
fi
done
exit ${retvalue}

0 comments on commit b500d26

Please sign in to comment.