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

Contents of /M6502/t/01-arch.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 53 - (show annotations)
Tue Jul 31 13:22:51 2007 UTC (16 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1066 byte(s)
test architecture
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use lib './lib';
7
8 use Test::More tests => 18;
9 use Test::Exception;
10 use Data::Dump qw/dump/;
11
12 BEGIN {
13 use_ok( 'Arch' );
14 }
15
16 ok( my $orao = Arch->new, 'new' );
17
18 isa_ok( $orao, 'Arch' );
19
20 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( $a, @v );
34
35 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( $a, $a + $#v ) ], [ @v ], 'ram' );
40 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 test_mem( 0x1000 );
49 test_mem( 0x6000 );
50 test_mem( 0x7000 );
51 dies_ok { test_mem( 0xf000 ) } 'access to ro memory';
52

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26