/[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 154 - (show annotations)
Sun Aug 5 16:27:46 2007 UTC (16 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1534 byte(s)
and finally, file append test that fails
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 => 27;
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 my $path = '/tmp/foo';
34 unlink $path if -e $path;
35
36 my $size = 0;
37
38 foreach my $data ( qw/a b c foo bar aaaabbbbccccddddeeeeffff/ ) {
39 VRac->append_to_file( $path, $data );
40 $size += length($data);
41 cmp_ok(-s $path, '==', $size);
42 }
43 };
44
45 ok( $orao->run, 'run' );
46
47 sub test_mem {
48 my $a = shift;
49 my @v = ( 0xff, 0x00, 0xff, 0xaa );
50
51 my $l = $#v + 1;
52
53 $orao->poke_code( $a, @v );
54
55 diag sprintf(" %04x - %04x : ", $a, $a + $#v ), dump( @v );
56 diag "ram = ",dump( $orao->ram( $a, $a + $#v ) );
57 diag $orao->hexdump( $a, $a + $#v );
58
59 is_deeply( [ $orao->ram( $a, $a + $#v ) ], [ @v ], 'ram' );
60 is_deeply( [ $orao->ram( $a, $a + $#v ) ], [ @v ], 'ram doesn\'t mutate' );
61
62 $orao->poke_code( $a + 4, 0x11, 0x22, 0x33, 0x44 );
63
64 like( $orao->hexdump( $a, $a + 4 ), qr/ ff 00 ff aa 11 22 33 44/, 'hexdump' );
65
66 }
67
68 test_mem( 0x1000 );
69 test_mem( 0x6000 );
70 test_mem( 0x7000 );
71 dies_ok { $orao->poke_code( 0xf000, 1 ) } 'access to ro memory';
72

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26