Test Anything Protocol

Test Anything Protocol

pgTAP

Using Bats

test.sh

#!/usr/bin/env bats

@test "Buttons and Lights" {
  run ./player.pl buttonslights.pl
  [ "$output" = "[does(robot,a),does(robot,b),does(robot,a),does(robot,c),does(robot,b),does(robot,a)]" ]
}

@test "addition using dc" {
  result="$(echo 2 2+p | dc)"
  [ "$result" -eq 4 ]
}