-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtest.js
62 lines (52 loc) · 1.34 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
var FAILED = 0;
function EXPECT_GE(a, b, msg) {
if (msg === undefined) { msg = "";}
if (a < b) {
console.error("EXPECT_GE: Expected: (" + a + ") >= (" + b + "), but not. " + msg);
console.error(new Error().stack);
FAILED++;
}
}
function EXPECT_LE(a, b, msg) {
if (msg === undefined) { msg = "";}
if (a > b) {
console.error("EXPECT_LE: Expected: (" + a + ") <= (" + actual + "), but not. " + msg);
console.error(new Error().stack);
FAILED++;
}
}
function EXPECT_EQ(expected, actual, msg) {
if (msg === undefined) { msg = "";}
if (JSON.stringify(expected) != JSON.stringify(actual)) {
console.error("EXPECT_EQ: Expected: " + JSON.stringify(expected, null, 2) +
", but actual: " + JSON.stringify(actual, null, 2) + ". " + msg);
console.error(new Error().stack);
FAILED++;
}
}
function test() {
FAILED = 0;
// alogos.js
testGetOverlappedDuration();
testGetDistanceFromLatLonInMeters();
testGetRisk();
testCheckContact();
// utils.js
testConvKmlDateToTimestamp();
testShuffleFloat();
testMyJsonParse();
// lib_sthash.js
testQuantifyDuration();
testQuantifyLatLng();
testHmac();
testHashSpacetime();
// parsers.js
testIntrapolateCoords();
// meta.js
testBoundingBox();
if (FAILED) {
console.error("[FAIL]");
} else {
console.log("[PASS]");
}
}