-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
43 lines (38 loc) · 1.87 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
const scriptures= require("./scriptures.js")
let output,ref;
console.log("\n===================\n\n");
let testcases =
[
["Simple reference", "Exodus 1:1"],
["Simple chapter", "Genesis 2"],
["Split chapters", "Genesis 1,3"],
["Chapter range", "Exodus 3-5"],
["Chapter range and split", "Exodus 3-5,8"],
["Verse range", "Exodus 20:1-10"],
["Verse range and split", "Exodus 20:1-5,10"],
["Verse Split", "Exodus 20:5,10"],
["Verse range spanning multiple chapters", "Exodus 1:5-4:3"],
["Chapter range ending in partial chapter", "Exodus 3-4:10"],
["Chapter range spanning multiple books", "Genesis 30 - Exodus 2"],
["Chapter range spanning multiple books, ending in partial chapter", "Genesis 30 - Exodus 2:5"],
["Chapter range spanning multiple books, starting in partial chapter", "Genesis 30:10 - Exodus 2"],
["Chapter range spanning multiple books, starting and ending with partial chapters", "Genesis 30:10 - Exodus 2:5"],
["Compound reference in same book","Exodus 5:1;6:2;8:5"],
["Compound reference in different books","Exodus 5:1; Leviticus 6:2; Numbers 8:5"],
["Compound reference ranges in different books","Exodus 5:1-3; Leviticus 6:2-5; Numbers 8:5-6"],
["Entire Book Range","Genesis - Numbers"],
["Abbreviation detection","Mt2.5;Mk3;Lk4;Jn5.2-6;1Jn1.5,7-8;3Jn1.1"],
["Other Books","1 Nephi 19:11"]
]
for (let i in testcases)
{
console.log("\n===================\n\nTEST CASE #"+(parseInt(i)+1)+": "+testcases[i][0]);
console.log("Input: ");
console.log([testcases[i][1]]);
output = scriptures.lookupReference(testcases[i][1]);
console.log("Output: ");
console.log(output);
ref = scriptures.generateReference(output.verse_ids);
console.log("Reference generated from verse ids: ");
console.log([ref]);
}