Sha256: 0ee016f4a6b045ab3ff80aa373dbd35b7ba998d9c0cfcd26b828e686f1cf0138

Contents?: true

Size: 779 Bytes

Versions: 3

Compression:

Stored size: 779 Bytes

Contents

#!/usr/bin/env bats

@test "zero steps for one" {
  #skip
  run bash collatz.sh 1

  [ "$status" -eq 0 ]
  [ "$output" -eq 0 ]
}

@test "divide if even" {
  skip
  run bash collatz.sh 16

  [ "$status" -eq 0 ]
  [ "$output" -eq 4 ]
}

@test "even and odd steps" {
  skip
  run bash collatz.sh 12

  [ "$status" -eq 0 ]
  [ "$output" -eq 9 ]
}

@test "large number of even and odd steps" {
  skip
  run bash collatz.sh 1000000

  [ "$status" -eq 0 ]
  [ "$output" -eq 152 ]
}

@test "zero is an error" {
  skip
  run bash collatz.sh 0

  [ "$status" -eq 1 ]
  [ "$output" == "Error: Only positive numbers are allowed" ]
}

@test "negative value is an error" {
  skip
  run bash collatz.sh -15

  [ "$status" -eq 1 ]
  [ "$output" == "Error: Only positive numbers are allowed" ]
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trackler-2.2.1.86 tracks/bash/exercises/collatz-conjecture/collatz_test.sh
trackler-2.2.1.85 tracks/bash/exercises/collatz-conjecture/collatz_test.sh
trackler-2.2.1.84 tracks/bash/exercises/collatz-conjecture/collatz_test.sh