blob: 19ad36e0df41fdb77bd9bc1f3564827d118bbbe4 [file] [log] [blame]
icetindil82838a22013-10-11 16:41:18 -07001#!/bin/bash
2
3TMP=/tmp/verify_
4
5if [ $# -lt "2" ]
6then
7 echo "Usage: `basename $0` result.txt result.T.txt [-u]"
8 exit $E_BADARGS
9fi
10
11args=( $@ )
12for i in 0 1
13do
14 f=${args[$i]}
15 ### Assume second argument is alredy sorted and with no duplicates
16 if [ "$i" -eq "0" ]
17 then
18 sort $3 $f > $TMP$i
19 else
20 rm $TMP$i 2> /dev/null
21 ln -s $PWD/$f $TMP$i
22 fi
23 if [ "$?" -ne "0" ]
24 then
25 echo Fail -- preprocessing
26 exit 1
27 fi
28
29 l[$i]=`wc --lines $TMP$i | cut --delimiter=" " --fields=1`
30 if [ "$?" -ne "0" ]
31 then
32 echo Fail -- preprocessing
33 exit 1
34 fi
35done
36
37
38### Test 1
39if [ "${l[0]}" -ne "${l[1]}" ]
40then
41 echo $1 ${l[0]}
42 echo $2 ${l[1]}
43 echo Fail -- different number of tokens
44 exit 1
45fi
46
47### Test 2
48diff --brief ${TMP}0 ${TMP}1
49if [ "$?" -ne "0" ]
50then
51 echo Fail -- differnt tokens
52 exit 1
53fi
54rm ${TMP}0 ${TMP}1
55
56echo Pass