-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTEST.sh
More file actions
56 lines (44 loc) · 1.67 KB
/
TEST.sh
File metadata and controls
56 lines (44 loc) · 1.67 KB
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
#!/bin/bash
declare -a input
# Логин и пароль
input[0]="0-login admin -password 00000"
input[1]="0-password 00000 -login admin"
input[2]="2-login ?login? -password 00000"
input[3]="3-login NotRegUser -password NotRegUser"
input[4]="4-login admin -password WrongPassword"
# Логин, Пароль, Ресурс
input[5]="0-login admin -password 00000 -role READ -resource A"
input[6]="0-login admin -password 00000 -role WRITE -resource A.B"
input[7]="5-login admin -password 00000 -role UNKNOWNROLE -resource A"
input[8]="6-login admin -password 00000 -role EXECUTE -resource A"
# Логин, Пароль, Ресурс, Дата начала, Дата завершения, Объем
input[9]="0-login admin -password 00000 -role READ -resource A -ds 2015-12-31 -de 2016-12-31 -vol 55"
input[10]="7-login admin -password 00000 -role READ -resource A -ds 2017-12-31 -de 2016-12-31 -vol 55"
input[11]="7-login admin -password 00000 -role READ -resource A -ds time_start -de time_end -vol 55"
input[12]="7-login admin -password 00000 -role READ -resource A -ds 2015-12-31 -de 2016-12-31 -vol NOT_VALID"
# Справка
input[13]="0-login admin -h"
input[14]="0"
count=0
for ((i = 0; i < 15; i++)); do
printf "\ntest %s running...\n" "$i"
java -cp ./lib/kotlinx-cli-0.2.1.jar:main.jar app.MainKt ${input[$i]:1}
code=$?
expectedCode="${input[$i]:0:1}"
echo $code
echo "${expectedCode}"
if [[ "$code" == "${expectedCode}" ]]; then
printf "test %d passed\n" "$i"
else
printf "test %d failed\n" "$i"
((count++))
fi
done
if [[ $count -gt 0 ]]; then
printf "%s" "$count"
printf "\nError tests running\n"
exit 1
else
printf "Tests succeed\n"
exit 0
fi