49
|
1 package Test::Object::List;
|
|
2 use strict;
|
|
3 use warnings;
|
|
4
|
|
5 use base qw(IMPL::Test::Unit);
|
|
6 use IMPL::Test qw(test cmparray failed);
|
|
7 use IMPL::Object::List;
|
|
8 __PACKAGE__->PassThroughArgs;
|
|
9
|
|
10 test Creation => sub {
|
|
11 my $list = new IMPL::Object::List();
|
|
12
|
|
13 failed "Failed to create an empty list" unless $list;
|
|
14 };
|
|
15
|
|
16 test FilledByRef => sub {
|
|
17 my $data = [map rand 100, 1 .. 300];
|
|
18 my $list = new IMPL::Object::List($data);
|
|
19
|
|
20 failed("List filled incorrectlty") unless cmparray($data,$list);
|
|
21 };
|
|
22
|
|
23 test FilledByWrongRef => sub {
|
|
24 eval {
|
|
25 my $list = new IMPL::Object::List({});
|
|
26 };
|
|
27 unless ($@) {
|
|
28 failed("List can be initialized only by an ARRAY reference");
|
|
29 }
|
|
30 };
|
|
31
|
|
32 1;
|