📝 testing

This commit is contained in:
Nikolaj
2021-10-07 15:28:41 +02:00
parent 8f39ccb72c
commit b57db9596c
2 changed files with 30 additions and 1 deletions

View File

@ -1,7 +1,7 @@
CC=gcc CC=gcc
CFLAGS=-Wall -Wextra -pedantic -std=gnu99 -g CFLAGS=-Wall -Wextra -pedantic -std=gnu99 -g
LDFLAGS=-lm LDFLAGS=-lm
PROGRAMS=random_ids id_query_naive coord_query_naive PROGRAMS=random_ids id_query_naive id_query_indexed id_query_binsort coord_query_naive coord_query_kdtree
TESTS=.. TESTS=..
.PHONY: all test clean ../src.zip .PHONY: all test clean ../src.zip

29
A1/test.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
make
test_id_list=("65606" "1239383" "43850" "1858224" "360417" "47772" "195305" "869606611" "370244025" "109655" "129567706" "62449" "130219375" "1216406" "5559852" "410804" "904633" "3318382" "7109048" "172385")
test_ids=$(printf '%s\n' "${test_id_list[@]}")
for program in ./id_query_naive ./id_query_indexed ./id_query_binsort; do
echo -e "\n===testing $program==="
result=$(echo -e "$test_ids" | "$program" 20000records.tsv)
if [ "$(echo "$result" | grep 'not found')" == "" ]; then
echo "All ids found"
else
echo "$result" | grep 'not found'
fi
echo "$result" | grep 'Total query runtime'
done
test_coord_list=("0 0" "0 51.5" "45 45" "0 -90" "50 10" "10 10")
test_coords=$(printf '%s\n' "${test_coord_list[@]}")
for program in ./coord_query_naive ./coord_query_kdtree; do
echo -e "\n===Testing $program==="
result=$(echo -e "$test_coords" | "$program" 20000records.tsv)
echo "$result" | grep 'Total query runtime'
done