Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # sort test
- BIN=./hello
- MAXCOUNT=3 # count of tests
- MAX_A_SIZE=100 # max array size
- count=1
- while [ "$count" -le "$MAXCOUNT" ];do
- echo "------------- BEGIN TEST $count --------------"
- a_size=$RANDOM;
- let "a_size %= $MAX_A_SIZE"
- echo "Velikost pole: $a_size"
- # generate array
- array="";
- i=1
- while [ "$i" -le "$a_size" ];do
- array=`echo -e "$array\n$RANDOM"`
- let "i += 1"
- done
- # sort for correct order
- echo -e "$array"|sort -h|grep -E '[0-9]+' > correct_file
- # DO TEST
- $BIN <<< "$a_size $array"|grep -E '[0-9]+' > result_file
- # test result
- echo "Vysledek: diff correct_file result_file"
- diff correct_file result_file
- let "count += 1"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement