Skip to content
This repository has been archived by the owner on Sep 13, 2019. It is now read-only.

Added Unit Tests for RedBlackTree.js #37

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions spec/RedBlackTree.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var d = global.d;

describe('RedBlackTree', function() {

it('should add elements via add', function() {
const testTree = new d.structs.RedBlackTree();
testTree.add(50);
testTree.add(40);
testTree.add(60);
testTree.add(51);
testTree.add(41);
testTree.add(61);
expect(testTree.size).toBe(6);
});

it("should remove elements via delete", function() {
const testTree = new d.structs.RedBlackTree();
testTree.delete(50);
testTree.delete(40);
testTree.delete(60);
testTree.delete(51);
testTree.delete(41);
testTree.delete(61);
expect(testTree.size).toBe(0);
});

it("should return true when validating null", function() {
const testTree = new d.structs.RedBlackTree();
expect(testTree.validate(null)).toBe(true);
});


});
3 changes: 2 additions & 1 deletion spec/support/jasmine.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"utils.js",
"LinkedList.js",
"searchIterator.js",
"strategies.js"
"strategies.js",
"RedBlackTree.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
Expand Down