/[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

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

Legend:
Removed from v.29  
changed lines
  Added in v.80

  ViewVC Help
Powered by ViewVC 1.1.26