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