#!/usr/bin/expect

set timeout 5
set env(LANG) en_EN

spawn taptempo

expect {
  timeout { send_user "\nFail\n"; exit 1 }
  eof { send_user "\nFail\n"; exit 1 }
  "Hit enter key"
}

send "\r"

expect {
  timeout { send_user "\nFail\n"; exit 1 }
  eof { send_user "\nFail\n"; exit 1 }
  "Hit enter key"
}

sleep 1
send "\r"

expect {
  timeout { send_user "\nFail\n"; exit 1 }
  eof { send_user "\nFail\n"; exit 1 }
  -re "59 bpm|60 bpm|61 bpm"
}

sleep 1
send "\r"

expect {
  timeout { send_user "\nFail\n"; exit 1 }
  eof { send_user "\nFail\n"; exit 1 }
  -re "59 bpm|60 bpm|61 bpm"
}

sleep 6
send "\r"
sleep 0.5
send "\r"

expect {
  timeout { send_user "\nFail\n"; exit 1 }
  eof { send_user "\nFail\n"; exit 1 }
  -re "119 bpm|120 bpm|121 bpm"
}

send "q\r"
expect {
  timeout { send_user "\nFail\n"; exit 1 }
  eof { send_user "\nFail\n"; exit 1 }
  "Bye Bye"
}

