diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1af05820b5c73405224f5813b0ccf7d50e5ca75..780ad003611b8d8206753c32ecd4b41eb05fc017 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,13 +5,14 @@ before_script: - apt-get update - apt-get -y install build-essential make autoconf gcc gnuplot - make + - chmod +x tests/runTests.sh + - chmod +x tests/verifica + - gcc -std=c99 -o tests/test tests/geraMapa.c h1: stage: test script: - cd tests - - gcc -std=c99 -o test geraMapa.c - - chmod +x runTests.sh - ./runTests.sh -h "./floodit_h1" - gnuplot "tempos.plot" - gnuplot "medias.plot" @@ -31,8 +32,6 @@ h2: stage: test script: - cd tests - - gcc -std=c99 -o test geraMapa.c - - chmod +x runTests.sh - ./runTests.sh -h "./floodit_h2" - gnuplot "tempos.plot" - gnuplot "medias.plot" @@ -53,8 +52,6 @@ h4: stage: test script: - cd tests - - gcc -std=c99 -o test geraMapa.c - - chmod +x runTests.sh - ./runTests.sh -h "./floodit_h4" - gnuplot "tempos.plot" - gnuplot "medias.plot" @@ -75,8 +72,6 @@ h6: stage: test script: - cd tests - - gcc -std=c99 -o test geraMapa.c - - chmod +x runTests.sh - ./runTests.sh -h "./floodit_h6" - gnuplot "tempos.plot" - gnuplot "medias.plot" diff --git a/tests/runTests.sh b/tests/runTests.sh index 2b09c063678b169a01317175ed217a623a5b83d6..25207fcc31674919ecd08c7b07bda9e162b62b23 100755 --- a/tests/runTests.sh +++ b/tests/runTests.sh @@ -23,7 +23,7 @@ echo $HEUR tempo_max=120000 #120s # tamanhos do tabuleiro -tams=(4 8 16 32) +tams=(64 100) # lista de cores cores=(4 8 10) @@ -58,9 +58,6 @@ do DER=0 for j in $(seq 1 ${N_TESTES}) do - echo -ne "Tabuleiro ${i}x${i} com ${cor} cores: (${j}/${N_TESTES}) (T max: $(($T_max_cor/1000000000))." - printf "%03d" $(($T_max_cor/1000000%1000)) - echo -ne ") (${GREEN}${VIT}${NC}/${BLUE}${EMP}${NC}/${RED}${DER}${NC})"\\r semente=$RANDOM ./test $i $i $cor $semente @@ -78,16 +75,17 @@ do HRESP=$(cat "/tmp/heur${semente}.out" | tail -n2 | head -n1) if [ $RESP -gt $HRESP ]; then - #echo -ne "${RED}Heurística $(basename ${HEUR}) fez tabuleiro ${i} ${i} ${cor} ${semente} em ${HRESP} e nós em ${RESP}${NC}\n" echo "${i} ${i} ${cor} ${semente} (${HRESP})" >> ${TABULEIROS} DER=$(($DER + 1)) fi if [ $RESP -eq $HRESP ]; then - #echo -ne "${BLUE}Empatamos com $(basename ${HEUR}) no tabuleiro ${i} ${i} ${cor} ${semente} em ${HRESP}${NC}\n" EMP=$(($EMP + 1)) fi if [ $RESP -lt $HRESP ]; then - #echo -ne "${GREEN}Ganhamos de $(basename ${HEUR}) no tabuleiro ${i} ${i} ${cor} ${semente} com ${RESP}${NC}\n" + VALIDO=$(cat "/tmp/${semente}.in" "/tmp/resp${semente}.out" | ./verifica) + if [[ $VALIDO -eq 1 ]]; then + echo -ne "${RED}Nossa resposta para ${i} ${i} ${cor} ${semente} não é válida!!!${NC}\n\n" + fi VIT=$(($VIT + 1)) fi # tempo em segundos @@ -102,6 +100,10 @@ do rm "/tmp/${semente}.in" rm "/tmp/resp${semente}.out" rm "/tmp/heur${semente}.out" + + echo -ne "Tabuleiro ${i}x${i} com ${cor} cores: (${j}/${N_TESTES}) (T max: $(($T_max_cor/1000000000))." + printf "%03d" $(($T_max_cor/1000000%1000)) + echo -ne ") (${GREEN}${VIT}${NC}/${BLUE}${EMP}${NC}/${RED}${DER}${NC})"\\r done T_medio_cor=$(($T_soma_cor/${N_TESTES})) S_medio_cor=$(($T_medio_cor/1000000000)) diff --git a/tests/verifica b/tests/verifica new file mode 100755 index 0000000000000000000000000000000000000000..2e7509c77c7151258a56cf66fccd53a4b67ce349 Binary files /dev/null and b/tests/verifica differ