-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_sparse_tests
executable file
·52 lines (45 loc) · 1.26 KB
/
run_sparse_tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#
# Run exhaustive sparsity tests for ranges of K, L, and N.
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
if [ ! -f gensparseg ]
then
printf "${RED}FAILED${NC}\tPlease compile gensparseg before running these tests\n"
exit 1
fi
if [ ! -f filter_sparse ]
then
printf "${RED}FAILED${NC}\tPlease compile filter_sparse before running these tests\n"
exit 1
fi
for K in {1..3}
do
for L in {-9..9}
do
for N in {2..5}
do
for n in {1..8}
do
A=$(./gensparseg $n 0:999 -K$K -L$L -N$N 2> /dev/null | wc -l)
B=$(./gensparseg $n 2> /dev/null | ./filter_sparse $K $L $N 2> /dev/null | wc -l)
if [ $A -ne $B ]
then
printf "./gensparseg $n 0:999 -K${K}L${L}N${N}\t"
printf "${RED}FAILED${NC}\tExpected $B but got $A\n"
exit 1
fi
done
printf "./gensparseg n 0:999 -K${K}L${L}N${N}\t"
printf "${GREEN}OK${NC}\n"
done
done
done
diff <(echo "cookie") <(echo "cookie") > /dev/null
if [ $? -ne 0 ]; then
printf "${RED}FAILED${NC}\tFailed tests for (K,L,N)=(?,?,?)\n"
exit 1
fi
printf "\n${GREEN}PASSED ALL TESTS${NC}\n\n"
exit 0