diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79b348fa673bf2875d1ae9bbdffb77ed177c33fa..fc40341afc0877ad52a648c654df2bde8d8f2e6e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,6 +26,6 @@ build: checker: stage: test image: - name: gitlab.cs.pub.ro:5050/iocla/tema1-2023 + name: gitlab.cs.pub.ro:5050/iocla/tema1-2024 script: - ./checker/checker.sh \ No newline at end of file diff --git a/checker/checker.sh b/checker/checker.sh index 6d30ee0adfd98a969df4fcde8b051f37f15a4c51..0092d315f651d7906b6f7832f9983ed477330a64 100755 --- a/checker/checker.sh +++ b/checker/checker.sh @@ -1,94 +1,5 @@ #!/bin/bash -EXECUTABLE="../src/perfect" -TIMEOUT_DURATION=10 -SCORE=0 -TOTAL_SCORE=0 - -test_err() -{ - local temp_output='' - temp_output="$(mktemp)" - - timeout "$TIMEOUT_DURATION" bash -c "$EXECUTABLE > $temp_output 2>&1" - - diff -Zq "$temp_output" "./references/ref1" > /dev/null 2>&1 - return $? -} - -test_single() -{ - local temp_output='' - temp_output="$(mktemp)" - - timeout "$TIMEOUT_DURATION" xargs -a ./input/input2 -0 -I{} bash -c "$EXECUTABLE {} > $temp_output 2>&1" - - diff -Zq "$temp_output" "./references/ref2" > /dev/null 2>&1 - return $? -} - -test_multiple() -{ - local temp_output='' - temp_output="$(mktemp)" - - timeout "$TIMEOUT_DURATION" xargs -a ./input/input3 -0 -I{} bash -c "$EXECUTABLE {} > $temp_output 2>&1" - - diff -Zq "$temp_output" "./references/ref3" > /dev/null 2>&1 - return $? -} - -test_edge() -{ - local temp_output='' - temp_output="$(mktemp)" - - timeout "$TIMEOUT_DURATION" xargs -a ./input/input4 -0 -I{} bash -c "$EXECUTABLE {} > $temp_output 2>&1" - - diff -Zq "$temp_output" "./references/ref4" > /dev/null 2>&1 - return $? -} - -setup() -{ - pushd ../src > /dev/null || exit 1 - make -s build - popd > /dev/null || exit 1 -} - -cleanup() -{ - pushd ../src > /dev/null || exit 1 - make -s clean - popd > /dev/null || exit 1 -} - -test_fun_array=( \ - test_err "Name 1" 25 \ - test_single "Name 2" 25 \ - test_multiple "Name 3" 25 \ - test_edge "Name 4" 25 \ -) - -run_test() -{ - test_index="$1" - test_func_index=$((test_index * 3)) - description=${test_fun_array[$((test_func_index + 1))]} - points=${test_fun_array[$((test_func_index + 2))]} - TOTAL_SCORE=$((TOTAL_SCORE + points)) - - echo -ne "Testing\t\t$description\t" - if ${test_fun_array["$test_func_index"]} ; then - SCORE=$((SCORE + points)) - echo "$points/$points" - return 0 - else - echo "0/$points" - return 1 - fi -} - test_all() { cd ../src