[cage] Fix pgegrep, which was merely an innocent bystander in the Great Namespace...
[parrot.git] / t / examples / pasm.t
blobeb178a1d255d0c7cf1a795ac2ef26355c7487c43
1 #! perl
2 # Copyright (C) 2005-2006, Parrot Foundation.
3 # $Id$
5 use strict;
6 use warnings;
7 use lib qw( . lib ../lib ../../lib );
8 use Test::More;
9 use Parrot::Test tests => 3;
10 use Parrot::Config;
12 =head1 NAME
14 t/examples/pasm.t - Test examples in F<examples/pasm>
16 =head1 SYNOPSIS
18     % prove t/examples/pasm.t
20 =head1 DESCRIPTION
22 Test the examples in F<examples/pasm>.
24 =head1 TODO
26 Put expected output into the example files.
28 =head1 SEE ALSO
30 F<t/examples/pir.t>
32 =cut
34 # Set up expected output for examples
35 my %expected = (
37     'hello.pasm' => << 'END_EXPECTED',
38 Hello World
39 END_EXPECTED
41 #    'xml_parser.pasm' => << 'END_EXPECTED',
42 #Start xml version=1.0
43 #Start top
44 #Start inner foo=bar narf=poit
45 #Start junk
46 #Data Hello
47 #Close junk
48 #Start empty
49 #Close empty
50 #Close inner
51 #Close top
52 #END_EXPECTED
56 SKIP: {
57     skip( 'GMP is not available', 1 ) unless $PConfig{gmp};
59     $expected{'fact.pasm'} = << 'END_EXPECTED'
60 fact of 0 is: 1
61 fact of 1 is: 1
62 fact of 2 is: 2
63 fact of 3 is: 6
64 fact of 4 is: 24
65 fact of 5 is: 120
66 fact of 6 is: 720
67 fact of 7 is: 5040
68 fact of 8 is: 40320
69 fact of 9 is: 362880
70 fact of 10 is: 3628800
71 fact of 11 is: 39916800
72 fact of 12 is: 479001600
73 fact of 13 is: 6227020800
74 fact of 14 is: 87178291200
75 fact of 15 is: 1307674368000
76 fact of 16 is: 20922789888000
77 fact of 17 is: 355687428096000
78 fact of 18 is: 6402373705728000
79 fact of 19 is: 121645100408832000
80 fact of 20 is: 2432902008176640000
81 fact of 21 is: 51090942171709440000
82 fact of 22 is: 1124000727777607680000
83 fact of 23 is: 25852016738884976640000
84 fact of 24 is: 620448401733239439360000
85 fact of 25 is: 15511210043330985984000000
86 fact of 26 is: 403291461126605635584000000
87 fact of 27 is: 10888869450418352160768000000
88 fact of 28 is: 304888344611713860501504000000
89 fact of 29 is: 8841761993739701954543616000000
90 fact of 30 is: 265252859812191058636308480000000
91 END_EXPECTED
94 while ( my ( $example, $expected ) = each %expected ) {
95     example_output_is( "examples/pasm/$example", $expected );
98 TODO:
100     local $TODO = 'nanoforth2.pasm not testable yet';
101     fail('nanoforth2.pasm');
104 # Local Variables:
105 #   mode: cperl
106 #   cperl-indent-level: 4
107 #   fill-column: 100
108 # End:
109 # vim: expandtab shiftwidth=4: