Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit d2ea090

Browse files
committed
Adding some basic tests for prime number checker.
1 parent f93f6ce commit d2ea090

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

merge-sort/merge-sort.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function mergeSort (array, compare) {
3131
}
3232
}
3333
return result;
34-
}
34+
};
3535

3636
return merge(mergeSort(left), mergeSort(right));
37-
}
37+
};

test/prime-number.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var primeNumber = require('../prime-number/prime-number'),
2+
assert = require('assert');
3+
4+
describe('next highest number', function () {
5+
it('should return true if the number is a prime number', function () {
6+
assert.equal(primeNumber(859), true);
7+
assert.equal(primeNumber(983), true);
8+
assert.equal(primeNumber(283), true);
9+
});
10+
11+
it('should return false if the number is not prime', function () {
12+
assert.equal(primeNumber(324), false);
13+
assert.equal(primeNumber(-124), false);
14+
assert.equal(primeNumber(89325), false);
15+
});
16+
});

0 commit comments

Comments
 (0)