Skip to content

Commit

Permalink
Add related tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 19, 2018
1 parent 70f48a6 commit d1658da
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions spec/drupol/phptree/Node/TrieNodeSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types = 1);

namespace spec\drupol\phptree\Node;

use drupol\phptree\Node\KeyValueNode;
use drupol\phptree\Node\TrieNode;
use PhpSpec\ObjectBehavior;

class TrieNodeSpec extends ObjectBehavior
{
public function it_is_initializable()
{
$this->shouldHaveType(TrieNode::class);
}

public function it_can_add_node()
{
$this->beConstructedWith('root', 'root');

$nodes = [
'ab',
'abc',
'abcd',
'abcde',
'cb',
'cba',
'dcba',
'edcba',
];

foreach ($nodes as $key => $value) {
$nodes[$key] = new KeyValueNode($key, $value);
}

$this
->add(...$nodes)
->count()
->shouldReturn(25);
}
}

0 comments on commit d1658da

Please sign in to comment.