#! perl
# Copyright (C) 2005-2006, The Perl Foundation.
# $Id: pasm.t 17094 2007-02-20 20:10:40Z paultcochrane $

use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 6;
use Parrot::Config;

=head1 NAME

t/examples/pasm.t - Test examples in F<examples/pasm>

=head1 SYNOPSIS

    % prove t/examples/pasm.t

=head1 DESCRIPTION

Test the examples in F<examples/pasm>.

=head1 TODO

Put expected output into the example files.

=head1 SEE ALSO

F<t/examples/pir.t>

=cut

# Set up expected output for examples
my %expected = (

    'fact.pasm' => << 'END_EXPECTED',
fact of 0 is: 1
fact of 1 is: 1
fact of 2 is: 2
fact of 3 is: 6
fact of 4 is: 24
fact of 5 is: 120
fact of 6 is: 720
END_EXPECTED

    'hello.pasm' => << 'END_EXPECTED',
Hello World
END_EXPECTED

    'queens.pasm' => << 'END_EXPECTED',
Making new board with 8 ranks and 8 files...
Board length is 64.
  +---+---+---+---+---+---+---+---+
8 |   | * | Q | * |   | * |   | * |
  +---+---+---+---+---+---+---+---+
7 | * |   | * |   | * | Q | * |   |
  +---+---+---+---+---+---+---+---+
6 |   | * |   | Q |   | * |   | * |
  +---+---+---+---+---+---+---+---+
5 | * | Q | * |   | * |   | * |   |
  +---+---+---+---+---+---+---+---+
4 |   | * |   | * |   | * |   | Q |
  +---+---+---+---+---+---+---+---+
3 | * |   | * |   | Q |   | * |   |
  +---+---+---+---+---+---+---+---+
2 |   | * |   | * |   | * | Q | * |
  +---+---+---+---+---+---+---+---+
1 | Q |   | * |   | * |   | * |   |
  +---+---+---+---+---+---+---+---+
    A   B   C   D   E   F   G   H  
END_EXPECTED

    'stack.pasm' => << 'END_EXPECTED',
9876543210 9876543210 0123456789 0123456789 9876543210 9876543210
END_EXPECTED

    'xml_parser.pasm' => << 'END_EXPECTED',
Start xml version=1.0
Start top
Start inner foo=bar narf=poit
Start junk
Data Hello
Close junk
Start empty
Close empty
Close inner
Close top
END_EXPECTED

);

while ( my ( $example, $expected ) = each %expected ) {
    example_output_is( "examples/pasm/$example", $expected );
}

TODO:
{
    local $TODO = 'nanoforth2.pasm not testable yet';
    fail('nanoforth2.pasm');
}

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4:
