DASM
test-execute/Tests.pm
Go to the documentation of this file.
00001 #!/usr/bin/perl -w
00002 ##
00003 # Test rules for the test-execute directory: positive tests of execution
00004 # and output.
00005 #
00006 #    *.expect.run
00007 #        The file *.dasm is assembled and run. The output is captured,
00008 #        along with the registers.
00009 #        The result is compared to this output.
00010 #        If they do not match, the differences are printed and we terminate.
00011 #        This tests that the code execution is as expected - at least in
00012 #        terms of the terminal registers.
00013 #
00014 
00015 
00016 ##
00017 # Assemble the .dasm file and run it, with the cycle counts enabled;
00018 # comparing to the expectation.
00019 addTest('name' => 'Assemble and run, checking output and registers',
00020         'input'    => '(?<!expect)\.dasm$',
00021         'expect'   => '.expect.run',
00022         'generate' => sub {
00023                 my ($directory, $input) = @_;
00024 
00025                 my $cmd = "./dasm.pl -showregs -nocounts -notimes -run -i $directory/$input";
00026                 my ($rc, $output) = capture_output($cmd);
00027 
00028                 return ($rc, $output, $cmd);
00029             },
00030 
00031         'compare' => \&compare,
00032        );
00033 
00034 
00035 # Must return true
00036 1;