forked from adrienpsl/fdF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
correction_script.sh
executable file
·182 lines (139 loc) · 3.3 KB
/
correction_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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/env bash
# make re
function intro()
{
echo; echo;
echo ========================================
echo "test de push_swap avec $1 numero 10 fois"
}
function border()
{
a=`./checker $1 << EOF
EOF`
b=`./push_swap $1`
if [ "$a" != "OK" ];
then
echo "------- $1"
echo "check err : $a"
fi
if [ "$b" != "" ];
then
echo "------- $1"
echo "push err : $b"
fi
}
function err_str ()
{
echo ========================================
echo "test avec $1 en str"
a=`./checker $1`
b=`./push_swap $1`
if [ "$a" != "Error" ];
then
echo "------- $1"
echo "check err : $a"
fi
if [ "$b" != "Error" ];
then
echo "------- $1"
echo "push err : $b"
fi
valgrind --log-fd=1 ./checker $1 | grep "definitely lost"
valgrind --log-fd=1 ./push_swap $1 | grep "definitely lost"
}
function err_arg ()
{
echo ========================================
echo "test avec $1 en arg"
a=`./checker $@`
b=`./push_swap $@`
if [ "$a" != "Error" ];
then
echo "------- $@"
echo "check err : $a"
fi
if [ "$b" != "Error" ];
then
echo "------- $@"
echo "push err : $b"
fi
valgrind --log-fd=1 ./checker $@ | grep "definitely lost"
valgrind --log-fd=1 ./push_swap $@ | grep "definitely lost"
}
# # que push push
# nb="puts (1..10).to_a.shuffle.join(' ')"
# ARG=`ruby -e "$nb"` ;
# valgrind --log-fd=1 ./push_swap "$ARG"
#
# # que check check
# nb="puts (1..10).to_a.shuffle.join(' ')"
# ARG=`ruby -e "$nb"` ;
# ./push_swap "$ARG" | valgrind --log-fd=1 ./checker "$ARG"
function memcheck()
{
nb="puts (1..$1).to_a.shuffle.join(' ')"
ARG=`ruby -e "$nb"` ;
valgrind --log-fd=1 ./push_swap "$ARG" | grep "definitely lost"
./push_swap "$ARG" | valgrind --log-fd=1 ./checker "$ARG" | grep "definitely lost"
./push_swap "$ARG" | ./checker "$ARG"
./push_swap "$ARG" | wc -l
}
function check_mem()
{
echo; echo;
echo ========================================
echo "test de push_swap avec $1 numero 10 fois"
for tt in `seq 1 10`
do
memcheck $1
echo;
done
}
#*------------------------------------*\
# simple error
*------------------------------------*/
echo "bullshit test -------------------------------"
err_str a
err_str "a"
err_str a d
err_str "a b"
err_arg 444d
err_str "444d"
err_arg 444d
err_str "444d 55"
err_arg a111
err_str "a111 887"
err_arg -111-
err_str "-111-"
err_str "55 44 22 44"
err_arg 55 44 22 44
err_str "14 4 44 4564654646465"
err_arg 14 4 44 4564654646465
#*------------------------------------*\
# LIMIT
#*------------------------------------*/
border 2147483647
border "2147483647"
border -2147483648
border "-2147483648"
border 0
border "0"
border -0
border "-0"
valgrind --log-fd=1 ./checker 0 | grep "definitely lost"
valgrind --log-fd=1 ./push_swap 0 | grep "definitely lost"
valgrind --log-fd=1 ./checker | grep "definitely lost"
valgrind --log-fd=1 ./push_swap | grep "definitely lost"
check_mem 1
check_mem 2
check_mem 3
check_mem 15
check_mem 50
check_mem 100
check_mem 500
check_mem 1000
check_mem 5000
#leaks_check
#echo "$b"
# while true; do; ARG=`ruby -e "puts (-100..10000).to_a.shuffle.join(' ')"` | ./push_swap $ARG | ./checker $ARG ; done
# while 1; do; leaks_push checker | grep "Process" | grep "leaks_push"; done