diff --git a/A1/Makefile b/A1/Makefile index eb629c4..27d056f 100644 --- a/A1/Makefile +++ b/A1/Makefile @@ -1,7 +1,7 @@ CC=gcc CFLAGS=-Wall -Wextra -pedantic -std=gnu99 -g 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=.. .PHONY: all test clean ../src.zip diff --git a/A1/test.sh b/A1/test.sh new file mode 100644 index 0000000..7e6c6ad --- /dev/null +++ b/A1/test.sh @@ -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