/[VRac]/t/10-orao.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 /t/10-orao.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 132 - (show annotations)
Sat Aug 4 21:04:05 2007 UTC (16 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1296 byte(s)
Move some tests around and little improvements
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use blib;
7 use lib './lib';
8
9 use Test::More tests => 21;
10 use Test::Exception;
11 use Data::Dump qw/dump/;
12
13 BEGIN {
14 use_ok( 'Orao' );
15 }
16
17 ok( my $orao = Orao->new(), 'new' );
18
19 isa_ok( $orao, 'Orao' );
20
21 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->prefs, { scale => 1, show_mem => 0, debug => 0, trace => 0 }, 'prefs' );
27
28 *Orao::loop = sub {
29 my $self = shift;
30 isa_ok( $self->app, 'SDL::App' );
31 isa_ok( $self->event, 'SDL::Event' );
32 };
33
34 ok( $orao->run, 'run' );
35
36 sub test_mem {
37 my $a = shift;
38 my @v = ( 0xff, 0x00, 0xff, 0xaa );
39
40 my $l = $#v + 1;
41
42 $orao->poke_code( $a, @v );
43
44 diag sprintf(" %04x - %04x : ", $a, $a + $#v ), dump( @v );
45 diag "ram = ",dump( $orao->ram( $a, $a + $#v ) );
46 diag $orao->hexdump( $a, $a + $#v );
47
48 is_deeply( [ $orao->ram( $a, $a + $#v ) ], [ @v ], 'ram' );
49 is_deeply( [ $orao->ram( $a, $a + $#v ) ], [ @v ], 'ram doesn\'t mutate' );
50
51 $orao->poke_code( $a + 4, 0x11, 0x22, 0x33, 0x44 );
52
53 like( $orao->hexdump( $a, $a + 4 ), qr/ ff 00 ff aa 11 22 33 44/, 'hexdump' );
54
55 }
56
57 test_mem( 0x1000 );
58 test_mem( 0x6000 );
59 test_mem( 0x7000 );
60 dies_ok { $orao->poke_code( 0xf000, 1 ) } 'access to ro memory';
61

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26