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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 87 - (show annotations)
Thu Aug 2 11:08:10 2007 UTC (16 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1258 byte(s)
- transfer debug state into C, added accesor M6502->debug();
- update_*_R functions to keep perl vars in sync with C
- tests
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( 'M6502' );
15 }
16
17 cmp_ok( $debug, '==', 0, '$debug' );
18 cmp_ok( M6502::get_debug(), '==', 0, 'M6502::get_debug' );
19 cmp_ok( M6502->debug, '==', 0, 'M6502->debug' );
20
21 cmp_ok( M6502::set_debug( 1 ), '==', 1, 'M6502::set_debug');
22 cmp_ok( M6502::get_debug(), '==', 1, 'M6502::get_debug');
23 cmp_ok( $debug, '==', 0, '$debug still wrong');
24
25 cmp_ok( M6502->debug(1), '==', 1, 'M6502->debug(1)' );
26 cmp_ok( $debug, '==', 1, '$debug on' );
27 cmp_ok( M6502::get_debug(), '==', 1, 'get_debug on' );
28 cmp_ok( M6502->debug, '==', 1, 'M6502->debug on' );
29
30 cmp_ok( M6502->debug(0), '==', 0, 'M6502->debug(0)' );
31 cmp_ok( $debug, '==', 0, '$debug off' );
32 cmp_ok( M6502::get_debug(), '==', 0, 'get_debug off' );
33 cmp_ok( M6502->debug, '==', 0, 'M6502->debug off' );
34
35 M6502->debug( 1 ) if @ARGV;
36
37 diag "debug: $debug";
38
39 cmp_ok( $PC, '==', 0xbeef, 'PC' );
40
41 ok( M6502::reset(), 'reset' );
42
43 cmp_ok( $PC, '==', 0x4242, 'PC' );
44
45 diag dump_R();
46
47 $PC = 0xdead;
48
49 M6502::update_C_R();
50
51 $PC = 0xffff;
52
53 M6502::update_perl_R();
54
55 cmp_ok( $PC, '==', 0xdead, 'PC' );
56
57 ok( M6502::reset(), 'reset again' );
58
59 cmp_ok( $PC, '==', 0x4242, 'PC' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26