/[VRac]/M6502/t/05-M6502.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /M6502/t/05-M6502.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 196 by dpavlin, Sun Apr 13 00:44:07 2008 UTC revision 198 by dpavlin, Sun Apr 13 11:05:29 2008 UTC
# Line 6  use strict; Line 6  use strict;
6  use blib;  use blib;
7  use lib './lib';  use lib './lib';
8    
9  use Test::More tests => 92;  use Test::More tests => 164;
10  use Test::Exception;  use Test::Exception;
11  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
12    
# Line 79  $mem[$a++] = $_ foreach ( Line 79  $mem[$a++] = $_ foreach (
79  );  );
80    
81  my @flip_tests = (  my @flip_tests = (
82          { fill => 0b11101101, expect => 0b10110111 },          { fill => 0b11101101, expect => 0b10110111, callbacks => 0x33 },
83          { fill => 0b11101101, expect => 0b10110111, disable_all_callbacks => 1 },          { fill => 0b11101101, expect => 0b10110111, callbacks => 0x22 },
84          { fill => 0b11110000, expect => 0b00001111, disable_all_callbacks => 1 }          { fill => 0b11110000, expect => 0b00001111, callbacks => 0x11 },
85            { fill => 0b11110011, expect => 0b11001111, callbacks => 0x00 },
86  );  );
87    
88  foreach my $test ( @flip_tests ) {  foreach my $test ( @flip_tests ) {
89    
90          diag "test ",dump( $test );          diag "test ",dump( $test );
91    
92          is( M6502::disable_all_callbacks(), 0x11, 'disable_all_callbacks' ) if $test->{disable_all_callbacks};          is( M6502::set_all_callbacks( $test->{callbacks} ), $test->{callbacks}, 'set_all_callbacks' );
93    
94          $mem[$_] = $test->{fill} foreach ( 0x6000 .. 0x7ffff );          $mem[$_] = $test->{fill} foreach ( 0x6000 .. 0x7ffff );
95    
# Line 104  foreach my $test ( @flip_tests ) { Line 105  foreach my $test ( @flip_tests ) {
105    
106          foreach my $a ( 0x6000 .. 0x600c ) {          foreach my $a ( 0x6000 .. 0x600c ) {
107                  cmp_ok( $mem[$a], '==', $test->{expect}, sprintf('flipped %04x %08b -> %08b',$a, $test->{fill}, $mem[$a]) );                  cmp_ok( $mem[$a], '==', $test->{expect}, sprintf('flipped %04x %08b -> %08b',$a, $test->{fill}, $mem[$a]) );
108                    cmp_ok( M6502::get_callback( $a ), '==', $test->{callbacks}, 'callback' );
109          }          }
110  }  }

Legend:
Removed from v.196  
changed lines
  Added in v.198

  ViewVC Help
Powered by ViewVC 1.1.26