annotate _test/Test/Object/List.pm @ 19:1ca530e5c9c5

DOM схема, требует переработки в части схемы для описания схем. Автоверификация не проходит
author Sergey
date Fri, 11 Sep 2009 16:30:39 +0400
parents 2e546a5175dd
children 16ada169ca75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
2e546a5175dd in developing
Sergey
parents:
diff changeset
1 package Test::Object::List;
2e546a5175dd in developing
Sergey
parents:
diff changeset
2 use strict;
2e546a5175dd in developing
Sergey
parents:
diff changeset
3 use warnings;
2e546a5175dd in developing
Sergey
parents:
diff changeset
4
2e546a5175dd in developing
Sergey
parents:
diff changeset
5 use base qw(IMPL::Test::Unit);
2e546a5175dd in developing
Sergey
parents:
diff changeset
6 use IMPL::Test qw(test cmparray failed);
2e546a5175dd in developing
Sergey
parents:
diff changeset
7 use IMPL::Object::List;
2e546a5175dd in developing
Sergey
parents:
diff changeset
8 __PACKAGE__->PassThroughArgs;
2e546a5175dd in developing
Sergey
parents:
diff changeset
9
2e546a5175dd in developing
Sergey
parents:
diff changeset
10 test Creation => sub {
2e546a5175dd in developing
Sergey
parents:
diff changeset
11 my $list = new IMPL::Object::List();
2e546a5175dd in developing
Sergey
parents:
diff changeset
12
2e546a5175dd in developing
Sergey
parents:
diff changeset
13 failed "Failed to create an empty list" unless $list;
2e546a5175dd in developing
Sergey
parents:
diff changeset
14 };
2e546a5175dd in developing
Sergey
parents:
diff changeset
15
2e546a5175dd in developing
Sergey
parents:
diff changeset
16 test FilledByRef => sub {
2e546a5175dd in developing
Sergey
parents:
diff changeset
17 my $data = [map rand 100, 1 .. 300];
2e546a5175dd in developing
Sergey
parents:
diff changeset
18 my $list = new IMPL::Object::List($data);
2e546a5175dd in developing
Sergey
parents:
diff changeset
19
2e546a5175dd in developing
Sergey
parents:
diff changeset
20 failed("List filled incorrectlty") unless cmparray($data,$list);
2e546a5175dd in developing
Sergey
parents:
diff changeset
21 };
2e546a5175dd in developing
Sergey
parents:
diff changeset
22
2e546a5175dd in developing
Sergey
parents:
diff changeset
23 test FilledByWrongRef => sub {
2e546a5175dd in developing
Sergey
parents:
diff changeset
24 eval {
2e546a5175dd in developing
Sergey
parents:
diff changeset
25 my $list = new IMPL::Object::List({});
2e546a5175dd in developing
Sergey
parents:
diff changeset
26 };
2e546a5175dd in developing
Sergey
parents:
diff changeset
27 unless ($@) {
2e546a5175dd in developing
Sergey
parents:
diff changeset
28 failed("List can be initialized only by an ARRAY reference");
2e546a5175dd in developing
Sergey
parents:
diff changeset
29 }
2e546a5175dd in developing
Sergey
parents:
diff changeset
30 };
2e546a5175dd in developing
Sergey
parents:
diff changeset
31
2e546a5175dd in developing
Sergey
parents:
diff changeset
32 1;