Skip to content

Commit

Permalink
Added unit tests for create range function
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro404 committed May 21, 2018
1 parent b0fc218 commit e7291a8
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions test/test.js
Expand Up @@ -1663,9 +1663,56 @@ describe("Utilities", function() {
});

describe("createRange", function() {
var newTestData = testData.concat(-5, -2, 4, 6);

it("should be a function", function() {
expect(utilities.createRange instanceof Function).to.equal(true);
});

it("should produce the correct result for each test value", function() {
var results = [[], [], [], [], [], [], [0], [0, 1], [0, 1, 2, 3], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 5, 6]];

for(var i = 0; i < newTestData.length; i++) {
expect(utilities.toString(utilities.createRange(newTestData[i]))).to.equal(utilities.toString(results[i]));
}
});

it("should produce the correct result for each test value pair", function() {
var results = [
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [0], [0, 1], [0, 1, 2, 3], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4, 5, 6]],
[[], [], [], [], [], [], [], [1], [1, 2, 3], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [1, 2, 3, 4], [1, 2, 3, 4, 5, 6]],
[[], [], [], [], [], [], [], [], [3], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [3, 4], [3, 4, 5, 6]],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []],
[[], [], [], [], [], [], [-5, -4, -3, -2, -1, 0], [-5, -4, -3, -2, -1, 0, 1], [-5, -4, -3, -2, -1, 0, 1, 2, 3], [], [], [], [], [], [], [], [], [], [], [], [], [], [-5], [-5, -4, -3, -2], [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4], [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6]],
[[], [], [], [], [], [], [-2, -1, 0], [-2, -1, 0, 1], [-2, -1, 0, 1, 2, 3], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [-2], [-2, -1, 0, 1, 2, 3, 4], [-2, -1, 0, 1, 2, 3, 4, 5, 6]],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [4], [4, 5, 6]],
[[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [6]]
];

for(var i = 0; i < newTestData.length; i++) {
for(var j = 0; j < newTestData.length; j++) {
expect(utilities.toString(utilities.createRange(newTestData[i], newTestData[j]))).to.equal(utilities.toString(results[i][j]));
}
}
});
});

describe("futureMonths", function() {
Expand Down

0 comments on commit e7291a8

Please sign in to comment.