forked from 61c-teach/sp22-proj2-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
143 lines (138 loc) · 4.5 KB
/
test.sh
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/env bash
set -eu
###########################################################
# Change the next line as needed if auto-detection fails. #
# When in doubt, ask on Piazza. #
# e.g. python_exec="py" #
###########################################################
python_exec=""
if [ -z "${python_exec}" ]; then
if command -v py 2>&1 >/dev/null; then
python_exec=py
elif command -v python3 2>&1 >/dev/null; then
python_exec=python3
elif command -v python 2>&1 >/dev/null; then
python_exec=python
fi
fi
if [[ "$("${python_exec}" -c 'import sys; print(sys.version_info[0])')" -ne "3" ]]; then
echo "Error: couldn't detect Python version. Is `${python_exec}` Python 3?"
"${python_exec}" -V
exit 1
fi
help() {
echo "--------------------HELP--------------------"
echo "To test this project type: bash test.sh all"
echo "To test part A, type: bash test.sh part_a"
echo "To test part B, type: bash test.sh part_b"
echo "To test coverage, type: bash test.sh coverage"
echo "To test a function type: bash test.sh test_FUNCTION_NAME"
echo " Remember to replace FUNCTION_NAME"
echo "--------------------------------------------"
}
if [ -z "${1:-}" ]; then
help
exit 1
fi
case "${1}" in
all)
"${python_exec}" -m unittest unittests.py -v
;;
coverage)
"${python_exec}" -m unittest studenttests.py -v
;;
part_a)
"${python_exec}" -m unittest unittests.TestAbs unittests.TestRelu unittests.TestArgmax unittests.TestDot unittests.TestMatmul -v
;;
part_b)
"${python_exec}" -m unittest unittests.TestReadMatrix unittests.TestWriteMatrix unittests.TestClassify unittests.TestChain -v
;;
test_abs)
"${python_exec}" -m unittest unittests.TestAbs -v
;;
test_relu)
"${python_exec}" -m unittest unittests.TestRelu -v
;;
test_argmax)
"${python_exec}" -m unittest unittests.TestArgmax -v
;;
test_argmax_length_1)
"${python_exec}" -m unittest unittests.TestArgmax.test_argmax_length_1 -v
;;
test_argmax_standard)
"${python_exec}" -m unittest unittests.TestArgmax.test_argmax_standard -v
;;
test_dot)
"${python_exec}" -m unittest unittests.TestDot -v
;;
test_dot_standard)
"${python_exec}" -m unittest unittests.TestDot.test_dot_standard -v
;;
test_dot_length_1)
"${python_exec}" -m unittest unittests.TestDot.test_dot_length_1 -v
;;
test_dot_length_error)
"${python_exec}" -m unittest unittests.TestDot.test_dot_length_error -v
;;
test_dot_length_error2)
"${python_exec}" -m unittest unittests.TestDot.test_dot_length_error2 -v
;;
test_dot_stride)
"${python_exec}" -m unittest unittests.TestDot.test_dot_stride -v
;;
test_dot_stride_error1)
"${python_exec}" -m unittest unittests.TestDot.test_dot_stride_error1 -v
;;
test_matmul)
"${python_exec}" -m unittest unittests.TestMatmul -v
;;
test_matmul_square)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_square -v
;;
test_matmul_nonsquare_1)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_nonsquare_1 -v
;;
test_matmul_nonsquare_2)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_nonsquare_2 -v
;;
test_matmul_length_1)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_length_1 -v
;;
test_matmul_zero_dim_m0)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_zero_dim_m0 -v
;;
test_matmul_negative_dim_m0_y)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_negative_dim_m0_y -v
;;
test_matmul_negative_dim_m0_x)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_negative_dim_m0_x -v
;;
test_matmul_zero_dim_m1)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_zero_dim_m1 -v
;;
test_matmul_negative_dim_m1_y)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_negative_dim_m1_y -v
;;
test_matmul_negative_dim_m1_x)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_negative_dim_m1_x -v
;;
test_matmul_unmatched_dims)
"${python_exec}" -m unittest unittests.TestMatmul.test_matmul_unmatched_dims -v
;;
test_read_matrix)
"${python_exec}" -m unittest unittests.TestReadMatrix -v
;;
test_write_matrix)
"${python_exec}" -m unittest unittests.TestWriteMatrix -v
;;
test_classify)
"${python_exec}" -m unittest unittests.TestClassify -v
;;
test_chain)
"${python_exec}" -m unittest unittests.TestChain -v
;;
*)
help
exit 1
;;
esac