blob: 29569d7ae0d8cfd61892d4389b53d371d010071e (
plain)
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
|
#!/bin/bash
# Convert all hex files to binary
find files/ -iname "*.hex" | while read f; do xxd -r -p $f > ${f%.hex}.bin; done
# Messages
PASS_MSG=$(echo -e "\033[0;32mPASS\033[0m")
FAIL_MSG=$(echo -e "\033[0;31mFAIL\033[0m")
# Keep totals
total_pass=0
total_fail=0
# Run Appendix A tests
pass=0
fail=0
echo ""
echo "============================== APPENDIX A =============================="
for f in files/appendix_a/*.bin; do
answer_file=${f%.bin}.answer
result_file=${f%.bin}.result
declare -a opts=("" "--tree")
for opt in "${opts[@]}"; do
../bin/ecbor-describe $opt $f > $result_file 2>/dev/null
rc=$?
if [ ! -f $result_file ] || [ ! -f $answer_file ] || [ "$(diff $answer_file $result_file 2>/dev/null)" != "" ]; then
fail=$(($fail + 1))
status=$FAIL_MSG
else
pass=$(($pass + 1))
status=$PASS_MSG
fi
test_name="$f($opt)"
machine_indented=$(printf '%-67s' "$test_name")
machine_indented=${machine_indented// /.}
printf "%s %s\n" "$machine_indented" "$status"
done
done
echo "========================================================================"
echo "Passed / Failed: ${pass}/${fail}"
total_pass=$(($total_pass + $pass))
total_fail=$(($total_fail + $fail))
# Final report
echo ""
echo ""
echo "============================== FINAL REPORT ============================"
echo "Total tests passed: $total_pass"
echo "Total tests failed: $total_fail"
echo "========================================================================"
|