/[VRac]/M6502/t/01-arch.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/01-arch.t

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

revision 52 by dpavlin, Mon Jul 30 21:00:36 2007 UTC revision 53 by dpavlin, Tue Jul 31 13:22:51 2007 UTC
# Line 5  use strict; Line 5  use strict;
5    
6  use lib './lib';  use lib './lib';
7    
8  use Test::More tests => 6;  use Test::More tests => 18;
9    use Test::Exception;
10  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
11    
12  BEGIN {  BEGIN {
13  use_ok( 'Arch' );  use_ok( 'Arch' );
14  }  }
15    
16  ok( my $orao = Arch->new({  ok( my $orao = Arch->new, 'new' );
17          mmu => sub {},  
 }), 'new' );  
18  isa_ok( $orao, 'Arch' );  isa_ok( $orao, 'Arch' );
19    
20  my @v = ( 0xff, 0x00, 0xff, 0xaa );  ok( $orao->scale( 1 ), 'scale' );
21    ok( ! $orao->show_mem( 0 ), 'show_mem' );
22    ok( ! $orao->debug( 0 ), 'debug' );
23    ok( ! $orao->trace( 0 ), 'trace' );
24    
25    ok( $orao->init, 'init' );
26    
27    sub test_mem {
28            my $a = shift;
29            my @v = ( 0xff, 0x00, 0xff, 0xaa );
30    
31            my $l = $#v + 1;
32    
33  $orao->poke_code( 0x1000, @v );          $orao->poke_code( $a, @v );
34    
35  diag dump( $orao->ram( 0x1000, 0x1004 ) );          diag sprintf(" %04x - %04x : ", $a, $a + $#v ), dump( @v );
36            diag "ram = ",dump( $orao->ram( $a, $a + $#v ) );
37            diag $orao->hexdump( $a, $a + $#v );
38    
39  is_deeply( [ $orao->ram( 0x1000, 0x1004 ) ], [ @v ], 'ram' );          is_deeply( [ $orao->ram( $a, $a + $#v ) ], [ @v ], 'ram' );
40  is_deeply( [ $orao->ram( 0x1000, 0x1004 ) ], [ @v ], 'ram doesn\'t mutate' );          is_deeply( [ $orao->ram( $a, $a + $#v ) ], [ @v ], 'ram doesn\'t mutate' );
41    
42            $orao->poke_code( $a + 4, 0x11, 0x22, 0x33, 0x44 );
43    
44            like( $orao->hexdump( $a, $a + 4 ), qr/ ff 00 ff aa 11 22 33 44/, 'hexdump' );
45    
46    }
47    
48  $orao->poke_code( 0x1004, 0x11, 0x22, 0x33, 0x44 );  test_mem( 0x1000 );
49    test_mem( 0x6000 );
50    test_mem( 0x7000 );
51    dies_ok { test_mem( 0xf000 ) } 'access to ro memory';
52    
 like( $orao->hexdump( 0x1000, 0x1004 ), qr/1000 ff 00 ff aa 11 22 33 44/, 'hexdump' );  

Legend:
Removed from v.52  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.26