-
Notifications
You must be signed in to change notification settings - Fork 1
/
uvOn.sh.bats
executable file
·53 lines (43 loc) · 1.07 KB
/
uvOn.sh.bats
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
#!/usr/bin/env bats
# testing uvOn.sh
executable=/home/pi/src/uvOn.sh
paramError='parameter error: percent := { 0..100 }, block := { 1..20 }'
@test "$executable without arguments" {
run $executable
[ "$status" -eq 0 ]
}
@test "$executable parameter 'percent' not multiple of 5 " {
run $executable 4 1
[ "$status" -eq 1 ]
[ "$output" == 'parameter error: percent has to be multiple of 5' ]
}
@test "$executable parameter 'percent' < 0 " {
run $executable -10 1
[ "$status" -eq 1 ]
[ "$output" == "$paramError" ]
}
@test "$executable parameter 'percent' > 100 " {
run $executable 101 1
[ "$status" -eq 1 ]
[ "$output" == "$paramError" ]
}
@test "$executable parameter 'block' < 1 " {
run $executable 10 0
[ "$status" -eq 1 ]
[ "$output" == "$paramError" ]
}
@test "$executable parameter 'block' > 20 " {
run $executable 10 21
[ "$status" -eq 1 ]
[ "$output" == "$paramError" ]
}
@test "$executable 5 1 := 1" {
run $executable 5 1
[ "$status" -eq 0 ]
[ "$output" -eq 1 ]
}
@test "$executable 5 2 := 0" {
run $executable 5 2
[ "$status" -eq 0 ]
[ "$output" -eq 0 ]
}