-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.sh
executable file
·81 lines (61 loc) · 2.24 KB
/
script.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
#!/bin/bash
#shebang means gotta use bash to run this
# number of tests
NOMBRE_DE_TESTS=25
GREEN='\033[32;1m'
RED='\033[31;1m'
WHITE='\033[0;m'
<< 'This-is-a-comment-thanks-to-here-doc'
This is a containers tester. It will test the containers and see
if they are working properly.
This is a function that will test the containers VECTOR
This-is-a-comment-thanks-to-here-doc
# (()) will change variables see there the rest: https://stackoverflow.com/questions/31255699/double-parenthesis-with-and-without-dollar
# .out are the output files of a program
tests=(constructors operateur_= iterators resize capacity assign erase insert
push_back pop_back clear rel_operators swap
top push pop empty rel_operators
map_constructors map_iterators map_capacity map_insert map_erase map_clear map_swap map_rel_opera
)
# This the execution of the testers and the diff
i=0
printf "%-23s%s%s\n" "TESTS " " FT STD DIF (en ms)"
printf "\n %s"" $GREEN VECTOR $WHITE \n"
while [[ $i -le $NOMBRE_DE_TESTS ]]
do
# annonce du container teste
if [[ $i -eq 13 ]]
then
printf "\n %s"" $GREEN STACK $WHITE \n"
fi;
if [[ $i -eq 18 ]]
then
printf "\n %s"" $GREEN MAP $WHITE \n"
fi;
start=$(date +%s%N) # start time in nanoseconds
./test_results/ft ${i} > ./test_results/ft_test_${i}.out
runtime_ft=$((($(date +%s%N) - $start)/1000000)) # runtime in milliseconds
start=$(date +%s%N)
./test_results/std ${i} > ./test_results/std_test_${i}.out
runtime_std=$((($(date +%s%N) - $start)/1000000))
diff ./test_results/std_test_${i}.out ./test_results/ft_test_${i}.out > test_results/difftest_${i}.out
time_diff=$((${runtime_ft}/${runtime_std}));
if ! [[ -s test_results/difftest_${i}.out ]];
then
printf "%-20s%-15s\n" "${i}: ${tests[${i}]}" " ✅ ${runtime_ft} ${runtime_std} ${time_diff}"
else
echo -e "\n ${i}: ${tests[${i}]} ❌ "
diff -y ./test_results/std_test_${i}.out ./test_results/ft_test_${i}.out
fi
# sleep 0.5
((i = i + 1))
done
<< testers
https://unix.stackexchange.com/questions/243489/bash-command-script-to-diff-all-mytestn-out-and-testn-out
diff test${i}.out mytest${i}.out > difftest${i}.txt
if ! [[ -s difftest${i} ]]; then
echo "
else
echo "❌"
fi
testers