-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux_test.sh
executable file
·58 lines (44 loc) · 1.2 KB
/
linux_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
51
52
53
54
55
56
57
#!/bin/bash
count_arg=$#
TEST_TYPE=("ALL" "BINARY TREE" "GRAPH" "HASH TABLE" "LINK LIST" "SORTING")
TEST_LEN=${#TEST_TYPE[@]}
if [ $count_arg -lt 1 ]
then
echo -e " number\t | Description"
echo "----------------------------"
for ((i = 0; i < $TEST_LEN; i++)); do
echo -e " $i \t | ${TEST_TYPE[$i]}"
done
printf "\nchoose test number:"
read type
else
type=$1
fi
if [[ $((type)) != $type ]]; then
echo "only number!"
exit 1
fi
if [ $type -gt $TEST_LEN ] || [ $type -lt 0 ];then
echo "invalid test number"
exit 2
fi
currentType=${TEST_TYPE[$type]}
# All
if [ "$currentType" == "${TEST_TYPE[0]}" ];then
cargo test -- --test-threads=1
# Binary Tree
elif [ "$currentType" == "${TEST_TYPE[1]}" ];then
echo ${TEST_TYPE[1]}
# Graph
elif [ "$currentType" == "${TEST_TYPE[2]}" ];then
cargo test graph -- --test-threads=1
# Hash Table
elif [ "$currentType" == "${TEST_TYPE[3]}" ];then
cargo test hash_table -- --test-threads=1
# Link List
elif [ "$currentType" == "${TEST_TYPE[4]}" ];then
cargo test link_list -- --test-threads=1
# Sort
elif [ "$currentType" == "${TEST_TYPE[5]}" ];then
cargo test sort -- --test-threads=1
fi