#!/usr/bin/perl use strict; $|=1; # Setup some variables my %AGI; my $tests = 0; my $fail = 0; my $pass = 0; my $result; while() { chomp; last unless length($_); if (/^agi_(\w+)\:\s+(.*)$/) { $AGI{$1} = $2; } } print STDERR "AGI Environment Dump:\n"; foreach my $i (sort keys %AGI) { print STDERR " -- $i = $AGI{$i}\n"; } sub checkresult { my ($res) = @_; my $retval; $tests++; chomp $res; if ($res =~ /^200/) { $res =~ /result=(-?\d+)/; if (!length($1)) { print STDERR "FAIL ($res)\n"; $fail++; } else { print STDERR "PASS ($1)\n"; $pass++; } } else { print STDERR "FAIL (unexpected result '$res')\n"; $fail++; } } print STDERR "6. Testing 'record'..."; print "RECORD FILE equals gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE minus gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE add gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE multiply gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE divide gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE math-game-good gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE math-game-pct gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE math-game-right gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE math-game-wrong gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE math-game-next gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE math-game-welcome gsm 3 -1\n"; $result = ; &checkresult($result); print "RECORD FILE math-game-timesup gsm 3 -1\n"; my $result = ; &checkresult($result); print "RECORD FILE math-game-right-answer gsm 3 -1\n"; my $result = ; &checkresult($result); print "RECORD FILE math-game-your-answer gsm 3 -1\n"; my $result = ; &checkresult($result); print STDERR "6a. Testing 'record' playback..."; print "STREAM FILE minus \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE add \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE multiply \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE divide \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE math-game-good \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE math-game-pct \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE math-game-right \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE math-game-wrong \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE math-game-next \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE math-game-welcome \"\"\n"; $result = ; &checkresult($result); print "STREAM FILE math-game-timesup \"\"\n"; my $result = ; &checkresult($result); print "STREAM FILE math-game-right-answer \"\"\n"; my $result = ; &checkresult($result); print "STREAM FILE math-game-your-answer \"\"\n"; my $result = ; &checkresult($result); print "STREAM FILE equals \"\"\n"; my $result = ; &checkresult($result); print STDERR "================== Complete ======================\n"; print STDERR "$tests tests completed, $pass passed, $fail failed\n"; print STDERR "==================================================\n";