tagged release 0.6.4
[parrot.git] / t / steps / auto_byteorder-02.t
blobb077a6b6896781bca3769a873750ff79794fbdae
1 #! perl
2 # Copyright (C) 2007, The Perl Foundation.
3 # $Id$
4 # auto_byteorder-02.t
6 use strict;
7 use warnings;
8 use Test::More tests =>  17;
9 use Carp;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::init::defaults');
12 use_ok('config::auto::byteorder');
13 use Parrot::Configure;
14 use Parrot::Configure::Options qw( process_options );
15 use Parrot::Configure::Test qw( test_step_thru_runstep);
17 my $args = process_options(
18     {
19         argv => [ ],
20         mode => q{configure},
21     }
24 my $conf = Parrot::Configure->new;
26 test_step_thru_runstep( $conf, q{init::defaults}, $args );
28 my $pkg = q{auto::byteorder};
30 $conf->add_steps($pkg);
31 $conf->options->set( %{$args} );
33 my ( $task, $step_name, $step);
34 $task        = $conf->steps->[-1];
35 $step_name   = $task->step;
37 $step = $step_name->new();
38 ok( defined $step, "$step_name constructor returned defined value" );
39 isa_ok( $step, $step_name );
42 my ($byteorder, $rv);
44 $byteorder = q{8765};
45 $rv = $step->_evaluate_byteorder($conf, $byteorder);
46 ok( $rv, "_evaluate_byteorder() returned true value as expected");
47 is( $conf->data->get( 'byteorder'), $byteorder, "Got expected byteorder");
48 ok( $conf->data->get( 'bigendian' ), "Not big-endian");
49 is( $step->result, 'big-endian', "Indeed, big-endian");
51 $byteorder = q{4321};
52 $rv = $step->_evaluate_byteorder($conf, $byteorder);
53 ok( $rv, "_evaluate_byteorder() returned true value as expected");
54 is( $conf->data->get( 'byteorder'), $byteorder, "Got expected byteorder");
55 ok( $conf->data->get( 'bigendian' ), "Not big-endian");
56 is( $step->result, 'big-endian', "Indeed, big-endian");
58 pass("Completed all tests in $0");
60 ################### DOCUMENTATION ###################
62 =head1 NAME
64 auto_byteorder-02.t - test config::auto::byteorder
66 =head1 SYNOPSIS
68     % prove t/steps/auto_byteorder-02.t
70 =head1 DESCRIPTION
72 The files in this directory test functionality used by F<Configure.pl>.
74 The tests in this file test subroutines exported by config::auto::byteorder.
76 =head1 AUTHOR
78 James E Keenan
80 =head1 SEE ALSO
82 config::auto::byteorder, F<Configure.pl>.
84 =cut
86 # Local Variables:
87 #   mode: cperl
88 #   cperl-indent-level: 4
89 #   fill-column: 100
90 # End:
91 # vim: expandtab shiftwidth=4: