
### -- t/base.t -- autogenerated from xilpl (21/04/2001) ---------###

use strict;
my $loaded = 0;

#- test loading ----------------------------------------------------#
BEGIN {
    $|++;
    print "1..7\n";
}
END {
    print "not ok 1\n" unless $loaded;
}

use Class::ArrayObjects qw();
$loaded = 1;
print "ok 1\n";


#- test constant generation ----------------------------------------#

package Foo::Test::ClArOb;
use Class::ArrayObjects define => {
                                    fields => [qw(zero one two)]
                                  };

print 'not ' if zero != 0 or one != 1 or two != 2;
print "ok 2\n";


#- test extension --------------------------------------------------#

package Foo::Test::ClArOb_2;
use Class::ArrayObjects extend => {
                                    class   => 'Foo::Test::ClArOb',
                                    with    => [qw(three four)],
                                  };


print 'not ' if three != 3 or four != 4;
print "ok 3\n";


#- test import -----------------------------------------------------#

package Foo::Test::ClArOb_3;
use Class::ArrayObjects extend => {
                                    class   => 'Foo::Test::ClArOb',
                                    with    => [qw(foo)],
                                    import  => 1,
                                  };

print 'not ' if (foo != 3);
print "ok 4\n";
eval { zero(); };
if ($@) {
    print "not ok 5\n";
    print "not ok 6\n";
}
else {
    print "ok 5\n";
    print 'not ' if zero != 0;
    print "ok 6\n";
}

#- test extension without class parameter --------------------------#

package Foo::Test::ClArOb_4;
BEGIN { @Foo::Test::ClArOb_4::ISA = 'Foo::Test::ClArOb' }
use Class::ArrayObjects extend => {
                                    with    => [qw(three four)],
                                  };


print 'not ' if three != 3 or four != 4;
print "ok 7\n";

