comparison _test/Test/DOM/Node.pm @ 37:c2e7f7c96bcd

performance improvements, DOM reworked (a little)
author Sergey
date Mon, 23 Nov 2009 00:59:06 +0300
parents 7f00786f8210
children 16ada169ca75
comparison
equal deleted inserted replaced
36:1828103371d0 37:c2e7f7c96bcd
15 } 15 }
16 16
17 test Create => sub { 17 test Create => sub {
18 my ($this) = @_; 18 my ($this) = @_;
19 19
20 $this->Root(new IMPL::DOM::Node(nodeName => 'Root')) or failed "Failed to create a node"; 20 $this->Root(new IMPL::DOM::Document(nodeName => 'Root')) or failed "Failed to create a document";
21 }; 21 };
22 22
23 test InsertNode => sub { 23 test InsertNode => sub {
24 my ($this) = @_; 24 my ($this) = @_;
25 my $child = $this->Root->insertNode(new IMPL::DOM::Node(nodeName => 'Child')) or failed "Failed to insert a child node"; 25 my $child = $this->Root->insertNode(new IMPL::DOM::Node(nodeName => 'Child')) or failed "Failed to insert a child node";
34 my $lastChild = $this->Root->removeLast; 34 my $lastChild = $this->Root->removeLast;
35 35
36 failed "removeLast returned incorrect results" unless $lastChild == $child; 36 failed "removeLast returned incorrect results" unless $lastChild == $child;
37 }; 37 };
38 38
39 test GetRootNode => sub { 39 test GetDocumentNode => sub {
40 my ($this) = @_; 40 my ($this) = @_;
41 41
42 my $child = $this->Root->firstChild->appendNode(new IMPL::DOM::Node(nodeName => 'GrandChild')) or failed "Failed to append a child node"; 42 my $child = $this->Root->firstChild->appendNode(new IMPL::DOM::Node(nodeName => 'GrandChild')) or failed "Failed to append a child node";
43 43
44 failed "rootNode is undef" unless $child->rootNode; 44 failed "document property is undef" unless $child->document;
45 failed "rootNode returned incorrect value" unless $child->rootNode == $this->Root; 45 failed "document property returned incorrect value" unless $child->document == $this->Root;
46 }; 46 };
47 47
48 test MoveNode => sub { 48 test MoveNode => sub {
49 my ($this) = @_; 49 my ($this) = @_;
50 50
51 my $grandChild = $this->Root->firstChild->firstChild; 51 my $grandChild = $this->Root->firstChild->firstChild;
52 $this->Root->appendNode($grandChild); 52 $this->Root->appendNode($grandChild);
53 53
54 failed "incorrect new parentNode value" unless ($grandChild->parentNode || 0) == $this->Root; 54 failed "incorrect new parentNode value" unless ($grandChild->parentNode || 0) == $this->Root;
55 failed "incorrect new rootNode value" unless ($grandChild->rootNode || 0) == $this->Root; 55 failed "incorrect new document value" unless ($grandChild->document || 0) == $this->Root;
56 }; 56 };
57 57
58 test AppendRange => sub { 58 test AppendRange => sub {
59 my ($this) = @_; 59 my ($this) = @_;
60 60