annotate _test/Test/Object/List.pm @ 101:d8dc6cad3f55

Schema in progress
author wizard
date Thu, 06 May 2010 17:55:59 +0400
parents 16ada169ca75
children 4267a2ac3d46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
1 package Test::Object::List;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
5 use base qw(IMPL::Test::Unit);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
6 use IMPL::Test qw(test cmparray failed);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
7 use IMPL::Object::List;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
8 __PACKAGE__->PassThroughArgs;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
10 test Creation => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
11 my $list = new IMPL::Object::List();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
13 failed "Failed to create an empty list" unless $list;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
14 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
15
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
16 test FilledByRef => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
17 my $data = [map rand 100, 1 .. 300];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
18 my $list = new IMPL::Object::List($data);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
19
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
20 failed("List filled incorrectlty") unless cmparray($data,$list);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
21 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
22
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
23 test FilledByWrongRef => sub {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
24 eval {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
25 my $list = new IMPL::Object::List({});
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
26 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
27 unless ($@) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
28 failed("List can be initialized only by an ARRAY reference");
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
29 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
30 };
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
31
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 3
diff changeset
32 1;