UNPKG
jsunittests
Version:
latest (1.0.5)
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
A quick way to make unittests for your code
jsunittests
/
example.js
16 lines
(10 loc)
•
267 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function
isOdd
(
n
) {
return
n %
2
==
1
; }
let
unittests =
require
(
'./unittests.js'
);
let
tests = [];
for
(
let
i = -
50
; i <
50
; i++) { tests.
push
([i, i %
2
===
1
]); }
var
results = unittests.
run_tests
(tests, isOdd); results.
print_results
();