@@ -54,10 +54,32 @@ public function it_can_get_a_hash()
54
54
55
55
$ this
56
56
->add (...$ nodes )
57
- ->getValue ()
57
+ ->hash ()
58
58
->shouldReturn ('c689102cdf2a5b30c2e21fdad85e4bb401085227aff672a7240ceb3410ff1fb6 ' );
59
59
}
60
60
61
+ public function it_can_get_its_label ()
62
+ {
63
+ $ this
64
+ ->label ()
65
+ ->shouldReturn ('root ' );
66
+
67
+ $ nodes = [
68
+ new MerkleNode (null , 2 , new DummyHasher ()),
69
+ new MerkleNode (null , 2 , new DummyHasher ()),
70
+ new MerkleNode ('a ' , 2 , new DummyHasher ()),
71
+ new MerkleNode ('b ' , 2 , new DummyHasher ()),
72
+ new MerkleNode ('c ' , 2 , new DummyHasher ()),
73
+ ];
74
+
75
+ $ this
76
+ ->add (...$ nodes );
77
+
78
+ $ this
79
+ ->label ()
80
+ ->shouldReturn ('abcc ' );
81
+ }
82
+
61
83
public function it_can_get_the_value_of_a_tree_with_a_single_node ()
62
84
{
63
85
$ this
@@ -83,7 +105,7 @@ public function it_can_get_the_value_of_a_tree_with_four_nodes()
83
105
->shouldReturn (5 );
84
106
85
107
$ this
86
- ->getValue ()
108
+ ->hash ()
87
109
->shouldReturn ('abcc ' );
88
110
89
111
$ this
@@ -100,7 +122,7 @@ public function it_can_get_the_value_of_a_tree_with_three_nodes()
100
122
101
123
$ this
102
124
->add (...$ nodes )
103
- ->getValue ()
125
+ ->hash ()
104
126
->shouldReturn ('ab ' );
105
127
}
106
128
@@ -110,7 +132,7 @@ public function it_can_get_the_value_of_a_tree_with_two_nodes()
110
132
111
133
$ this
112
134
->add ($ node )
113
- ->getValue ()
135
+ ->hash ()
114
136
->shouldReturn ('aa ' );
115
137
}
116
138
@@ -134,6 +156,10 @@ public function it_can_handle_null_values()
134
156
135
157
$ this
136
158
->getValue ()
159
+ ->shouldReturn ('root ' );
160
+
161
+ $ this
162
+ ->hash ()
137
163
->shouldReturn ('abcc ' );
138
164
139
165
$ this
0 commit comments