Skip to content

Commit d1658da

Browse files
committed
Add related tests.
1 parent 70f48a6 commit d1658da

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace spec\drupol\phptree\Node;
6+
7+
use drupol\phptree\Node\KeyValueNode;
8+
use drupol\phptree\Node\TrieNode;
9+
use PhpSpec\ObjectBehavior;
10+
11+
class TrieNodeSpec extends ObjectBehavior
12+
{
13+
public function it_is_initializable()
14+
{
15+
$this->shouldHaveType(TrieNode::class);
16+
}
17+
18+
public function it_can_add_node()
19+
{
20+
$this->beConstructedWith('root', 'root');
21+
22+
$nodes = [
23+
'ab',
24+
'abc',
25+
'abcd',
26+
'abcde',
27+
'cb',
28+
'cba',
29+
'dcba',
30+
'edcba',
31+
];
32+
33+
foreach ($nodes as $key => $value) {
34+
$nodes[$key] = new KeyValueNode($key, $value);
35+
}
36+
37+
$this
38+
->add(...$nodes)
39+
->count()
40+
->shouldReturn(25);
41+
}
42+
}

0 commit comments

Comments
 (0)