-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_test.sh
executable file
·82 lines (65 loc) · 1.71 KB
/
run_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
#!/bin/bash
run()
{
echo "Running: $1"
eval "$1"
}
check_diffs()
{
if [ $? -eq 0 ]
then
echo "No differences between the golden output and your output!"
else
echo "There were differences between the golden output and your output :("
fi
}
Check()
{
echo "Checking correctness againts small test sample\n"
cmd="python3 run_book.py -i data/input/check.txt -o data/output/check.txt"
run "$cmd"
cmd="diff data/output/check_golden.txt data/output/check.txt"
run "$cmd"
check_diffs
}
Run()
{
echo "Checking correctness agaisnt full orders file"
cmd="python3 run_book.py -i data/input/test.txt -o data/output/test.txt"
run "$cmd"
cmd="diff data/output/golden.txt data/output/test.txt"
run "$cmd"
check_diffs
}
MatchingEngine()
{
echo "Checking correctness againts small test sample for MatchingEngine\n"
cmd="python3 run_book.py -i data/input/matching.txt -o data/output/matching.txt -m"
run "$cmd"
cmd="diff data/output/matching_golden.txt data/output/matching.txt"
run "$cmd"
check_diffs
}
Time()
{
echo "Timing run on full orders file"
cmd="time python3 run_book.py -i data/input/test.txt -o data/output/test_time.txt"
run "$cmd"
}
tar xf data.tar.gz
while getopts ":crtm" option; do
case $option in
c) # Check correctness against small test sample
Check
break;;
r) # Check correctness against full orders file
Run
break;;
t) # Time run on full orders file
Time
break;;
m) # Check correctness against small test sample for MatchingEngine
MatchingEngine
break;;
esac
done