-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·51 lines (39 loc) · 1.14 KB
/
test.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
#!/bin/bash
echo "LOLCODE Test"
if [ $# -eq 0 ]; then
echo "Usage: ./test.sh <trials> <array_size> <max_value>"
exit 0
fi
trials=$1
array_size=$2
max_value=$3
seed=$RANDOM
echo "Trials="$trials
echo "Array Size="$array_size
echo "Max Value="$max_value
echo ""
echo "MAKE_ARRAY"
sed -i 's/I HAS A z ITZ .*/I HAS A z ITZ '$array_size'/' make_array.lol
for (( i=1; i<=$trials; i++ ))
do
sed -i 's/I HAS A prev ITZ .*/I HAS A prev ITZ '$seed'/' make_array.lol
seed=$RANDOM
/usr/bin/time --format='%e' lci make_array.lol
done
echo "COUNT_SORT"
sed -i 's/I HAS A z ITZ .*/I HAS A z ITZ '$array_size'/' count_sort.lol
sed -i 's/I HAS A rand_max ITZ .*/I HAS A rand_max ITZ '$max_value'/' count_sort.lol
for (( i=1; i<=$trials; i++ ))
do
sed -i 's/I HAS A prev ITZ .*/I HAS A prev ITZ '$seed'/' count_sort.lol
seed=$RANDOM
/usr/bin/time --format='%e ' lci count_sort.lol
done
echo "QUICK_SORT"
sed -i 's/I HAS A z ITZ .*/I HAS A z ITZ '$array_size'/' quick_sort.lol
for (( i=1; i<=$trials; i++ ))
do
sed -i 's/I HAS A prev ITZ .*/I HAS A prev ITZ '$seed'/' quick_sort.lol
seed=$RANDOM
/usr/bin/time --format='%e ' lci quick_sort.lol
done