blob: 9b6493d226d20bff350d86d3d04699dbb4b27c57 (
plain)
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
|
#!/usr/bin/env bats
load test_helper
@test "testing" {
result="$(echo 2+2 | bc)"
[ "$result" -eq 4 ]
}
@test "invoke with a single integer" {
run problem-6.sh 2
assert_success $'squares: 4\nsum: 2'
}
@test "invoke with multiple integers" {
run problem-6.sh 1 2 3 4 5 6 7 8 9 10
assert_success $'squares: 1 4 9 16 25 36 49 64 81 100\nsum: 55'
}
@test "invoke with single non-numeric" {
run problem-6.sh "oops"
assert_failure $'error: "oops" is not a number'
}
@test "invoke with multiple non-numeric" {
run problem-6.sh "oops" "invalid"
assert_failure $'error: "oops" is not a number\nerror: "invalid" is not a number'
}
|