Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test("Test empty tree 'Contains'") {
- // behind the scene this on create a node actor - follow props: Props(classOf[BinaryTreeNode], elem, initiallyRemoved)
- val testNode = system.actorOf(BinaryTreeNode.props(0, true))
- testNode ! Contains(testActor, id = 1, 0)
- expectMsg(ContainsResult(1, false))
- }
- test("Test empty tree 'Insert'") {
- val testNode = system.actorOf(BinaryTreeNode.props(0, true))
- testNode ! Insert(testActor, id = 1, 42)
- expectMsg(OperationFinished(1))
- testNode ! Contains(testActor, id = 2, 42)
- expectMsg(ContainsResult(2, true))
- }
- test("simple inserts and lookups") {
- val topNode = system.actorOf(Props[BinaryTreeSet])
- topNode ! Contains(testActor, id = 1, 1)
- expectMsg(ContainsResult(1, false))
- topNode ! Insert(testActor, id = 2, 1)
- topNode ! Contains(testActor, id = 3, 1)
- expectMsg(OperationFinished(2))
- expectMsg(ContainsResult(3, true))
- }
- test("proper inserts and lookups") {
- val topNode = system.actorOf(Props[BinaryTreeSet])
- topNode ! Contains(testActor, id = 1, 1)
- expectMsg(ContainsResult(1, false))
- topNode ! Insert(testActor, id = 2, 1)
- topNode ! Contains(testActor, id = 3, 1)
- expectMsg(OperationFinished(2))
- expectMsg(ContainsResult(3, true))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement