diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..bc0863c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cif-tests"] + path = cif-tests + url = https://github.com/comes-group/cif-tests diff --git a/cif-tests b/cif-tests new file mode 160000 index 0000000..b75d28c --- /dev/null +++ b/cif-tests @@ -0,0 +1 @@ +Subproject commit b75d28c082b4355be605e111690dca0ebf15bcca diff --git a/test_runner.sh b/test_runner.sh index 5923f5c..daa4fe1 100755 --- a/test_runner.sh +++ b/test_runner.sh @@ -1,8 +1,29 @@ #!/usr/bin/sh -for image in ../cif-tests/valid/*.cif; do +exit_code=0 + +echo "--- Valid tests: ---" +for image in cif-tests/valid/*.cif; do echo "Running test on $image" - ./zardzewialy-dekoder-cif $image aaa.png - echo "" + stderr="$(./zardzewialy-dekoder-cif $image aaa.png 2>&1 > /dev/null)" + if [[ ${#stderr} != 0 ]]; then + echo "Failed on a valid test:" + echo $stderr + exit_code=1 + fi done +echo "" +echo "--- Invalid tests: ---" +for image in cif-tests/invalid/*.cif; do + echo "Running test on $image" + stderr="$(./zardzewialy-dekoder-cif $image aaa.png 2>&1 /dev/null)" + if [[ ${#stderr} == 0 ]]; then + echo "Error: preduced an invalid image" + exit_code=1 + fi +done + +rm aaa.png +exit $exit_code +