File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ public function it_can_add_node()
20
20
$ this ->beConstructedWith ('root ' , 'root ' );
21
21
22
22
$ nodes = [
23
+ 1000 ,
24
+ 1001 ,
25
+ 10011 ,
26
+ 2000 ,
27
+ 2001 ,
28
+ 20011 ,
23
29
'ab ' ,
24
30
'abc ' ,
25
31
'abcd ' ,
@@ -31,12 +37,12 @@ public function it_can_add_node()
31
37
];
32
38
33
39
foreach ($ nodes as $ key => $ value ) {
34
- $ nodes [$ key ] = new KeyValueNode ($ key , $ value );
40
+ $ nodes [$ key ] = new KeyValueNode ($ key , ( string ) $ value );
35
41
}
36
42
37
43
$ this
38
44
->add (...$ nodes )
39
45
->count ()
40
- ->shouldReturn (25 );
46
+ ->shouldReturn (43 );
41
47
}
42
48
}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public function add(NodeInterface ...$nodes): NodeInterface
23
23
$ parent = $ this ->append ($ node );
24
24
25
25
$ dataWithoutFirstLetter = \substr ($ data , 1 );
26
- if (! empty ( $ dataWithoutFirstLetter) ) {
26
+ if ($ dataWithoutFirstLetter > '' ) {
27
27
$ parent ->add (new TrieNode ($ hash , $ dataWithoutFirstLetter ));
28
28
} else {
29
29
$ nodes = [$ node ->getValue ()];
You can’t perform that action at this time.
0 commit comments