Mercurial > pub > Impl
comparison _test/Test/Object/List.pm @ 3:2e546a5175dd
in developing
| author | Sergey |
|---|---|
| date | Tue, 11 Aug 2009 17:45:52 +0400 |
| parents | |
| children | 16ada169ca75 |
comparison
equal
deleted
inserted
replaced
| 2:78cd38551534 | 3:2e546a5175dd |
|---|---|
| 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; |
