summaryrefslogtreecommitdiff
path: root/test/problem-6.bats
blob: 0c370924769227d6d5a00c762962a9f489b90898 (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
#!/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'
}