]> git.llucax.com Git - z.facultad/75.52/treemulator.git/blob - test/test.sh
Bugfix del test.sh para que no 'oculte' errores por SIGSEGV.
[z.facultad/75.52/treemulator.git] / test / test.sh
1 #!/bin/bash
2
3 bloques_hasta=2
4 altas_hasta=2
5
6 [ -n $1 ] || bloques_hasta=$1
7 [ -n $2 ] || altas_hasta=$2
8
9 numero()
10 {
11         cifras=$1
12         echo -n 1
13         for i in `seq 1 $cifras`
14         do
15                 echo -n 0
16         done
17 }
18
19 result=0
20 for i in `seq -2 $bloques_hasta`
21 do
22         echo "Bloque: $i"
23         for j in `seq 0 $altas_hasta`
24         do
25                 a=`numero $j`
26                 echo -e "\tAltas: $a"
27                 for k in `seq 0 $j`
28                 do
29                         b=`numero $k`
30                         echo -e "\t\tBajas: $b"
31                         echo -ne "\t\t\tClave fija....... "
32                         ../src/btree $i $a $b > /tmp/btree_test
33                         if [ $? == 0 ]
34                         then
35                                 grep Miss /tmp/btree_test | grep -q '[1-9]'
36                                 if [ $? != 0 ]
37                                 then
38                                         echo 'OK!'
39                                 else
40                                         echo 'ERROR!'
41                                         result=$(($result+1))
42                                 fi
43                         else
44                                 echo 'ERROR!'
45                                 result=$(($result+1))
46                         fi
47                         echo -ne "\t\t\tClave variable... "
48                         ../src/btree_var $i $a $b > /tmp/btree_test
49                         if [ $? == 0 ]
50                         then
51                                 grep Miss /tmp/btree_test | grep -q '[1-9]'
52                                 if [ $? != 0 ]
53                                 then
54                                         echo 'OK!'
55                                 else
56                                         echo 'ERROR!'
57                                         result=$(($result+1))
58                                 fi
59                         else
60                                 echo 'ERROR!'
61                                 result=$(($result+1))
62                         fi
63                 done
64         done
65 done
66
67 exit $result