File Coverage

blib/lib/Language/Befunge/lib/ROMA.pm
Criterion Covered Total %
statement 11 17 64.7
branch n/a
condition n/a
subroutine 5 11 45.4
pod 8 8 100.0
total 24 36 66.6


line stmt bran cond sub pod time code
1             #
2             # This file is part of Language::Befunge.
3             # Copyright (c) 2001-2009 Jerome Quelin, all rights reserved.
4             #
5             # This program is free software; you can redistribute it and/or modify
6             # it under the same terms as Perl itself.
7             #
8             #
9              
10             package Language::Befunge::lib::ROMA;
11              
12 2     2   3848 use strict;
  2         5  
  2         91  
13 2     2   10 use warnings;
  2         4  
  2         67  
14              
15 2     2   10 use Language::Befunge::Vector;
  2         4  
  2         24  
16              
17 1     1 1 4 sub new { return bless {}, shift; }
18              
19             # -- roman numbers
20              
21             #
22             # push the corresponding value onto the stack:
23             # - M: 1000
24             # - D: 500
25             # - C: 100
26             # - L: 50
27             # - X: 10
28             # - V: 5
29             # - I: 1
30             #
31 0     0 1 0 sub C { $_[1]->get_curip->spush(100); }
32 0     0 1 0 sub D { $_[1]->get_curip->spush(500); }
33 0     0 1 0 sub I { $_[1]->get_curip->spush(1); }
34 0     0 1 0 sub L { $_[1]->get_curip->spush(50); }
35 1     1 1 7 sub M { $_[1]->get_curip->spush(1000); }
36 0     0 1   sub V { $_[1]->get_curip->spush(5); }
37 0     0 1   sub X { $_[1]->get_curip->spush(10); }
38              
39              
40             1;
41              
42             __END__