2 # Copyright (C) 2007, Parrot Foundation.
8 use Test::More tests => 24;
10 use lib qw( lib t/configure/testlib );
11 use_ok('config::auto::byteorder');
12 use Parrot::Configure::Options qw( process_options );
13 use Parrot::Configure::Step::Test;
14 use Parrot::Configure::Test qw(
15 test_step_constructor_and_description
18 ########## _evaluate_byteorder() ##########
20 my ($args, $step_list_ref) = process_options(
27 my $conf = Parrot::Configure::Step::Test->new;
28 $conf->include_config_results( $args );
30 my $pkg = q{auto::byteorder};
32 $conf->add_steps($pkg);
34 my $serialized = $conf->pcfreeze();
36 $conf->options->set( %{$args} );
37 my $step = test_step_constructor_and_description($conf);
39 my $byteorder = q{1234};
40 my $rv = $step->_evaluate_byteorder($conf, $byteorder);
41 ok( $rv, "_evaluate_byteorder() returned true value as expected");
42 is( $conf->data->get( 'byteorder'), $byteorder, "Got expected byteorder");
43 ok( ! $conf->data->get( 'bigendian' ), "Not big-endian");
44 is( $step->result, 'little-endian', "Rather, little-endian");
46 $conf->replenish($serialized);
48 ########## _evaluate_byteorder() ##########
50 ($args, $step_list_ref) = process_options(
57 $conf->options->set( %{$args} );
58 $step = test_step_constructor_and_description($conf);
61 $rv = $step->_evaluate_byteorder($conf, $byteorder);
62 ok( $rv, "_evaluate_byteorder() returned true value as expected");
63 is( $conf->data->get( 'byteorder'), $byteorder, "Got expected byteorder");
64 ok( $conf->data->get( 'bigendian' ), "big-endian");
65 is( $step->result, 'big-endian', "Indeed, big-endian");
68 $rv = $step->_evaluate_byteorder($conf, $byteorder);
69 ok( $rv, "_evaluate_byteorder() returned true value as expected");
70 is( $conf->data->get( 'byteorder'), $byteorder, "Got expected byteorder");
71 ok( $conf->data->get( 'bigendian' ), "big-endian");
72 is( $step->result, 'big-endian', "Indeed, big-endian");
74 $conf->replenish($serialized);
76 ########## _evaluate_byteorder(); phony byte order ##########
78 ($args, $step_list_ref) = process_options(
85 $conf->options->set( %{$args} );
86 $step = test_step_constructor_and_description($conf);
88 $byteorder = q{foobar};
90 $rv = $step->_evaluate_byteorder($conf, $byteorder);
93 qr/Unsupported byte-order \[$byteorder\]!/,
94 "Got error message expected with bad byte-order");
96 pass("Completed all tests in $0");
98 ################### DOCUMENTATION ###################
102 auto/byteorder-01.t - test auto::byteorder
106 % prove t/steps/auto/byteorder-01.t
110 The files in this directory test functionality used by F<Configure.pl>.
112 The tests in this file test auto::byteorder.
120 config::auto::byteorder, F<Configure.pl>.
126 # cperl-indent-level: 4
129 # vim: expandtab shiftwidth=4: