From 57598b99a99879662b0882106c4e83f18189a6df Mon Sep 17 00:00:00 2001 From: walljm Date: Mon, 16 Jan 2017 21:59:07 -0500 Subject: [PATCH] TESTS: moar better tests... * also bug fixes in strongs... --- DynamicBibleIonic/src/Reference.spec.ts | 583 +++++++++--------- DynamicBibleIonic/src/bible-service.spec.ts | 368 +++-------- DynamicBibleIonic/src/strongs-service.spec.ts | 57 ++ DynamicBibleIonic/src/strongs-service.ts | 75 +-- DynamicBibleIonic/src/word-service.ts | 26 +- DynamicBibleIonic/www/data/strongs/grk57.json | 1 + DynamicBibleIonic/www/data/strongs/heb87.json | 1 + .../.vs/config/applicationhost.config | 2 +- .../DynamicBibleUtility/frmMain.cs | 67 +- 9 files changed, 522 insertions(+), 658 deletions(-) create mode 100644 DynamicBibleIonic/src/strongs-service.spec.ts create mode 100644 DynamicBibleIonic/www/data/strongs/grk57.json create mode 100644 DynamicBibleIonic/www/data/strongs/heb87.json diff --git a/DynamicBibleIonic/src/Reference.spec.ts b/DynamicBibleIonic/src/Reference.spec.ts index 44aad700..86dd8e93 100644 --- a/DynamicBibleIonic/src/Reference.spec.ts +++ b/DynamicBibleIonic/src/Reference.spec.ts @@ -1,292 +1,305 @@ -import { Reference } from './Reference'; +import {Reference} from './Reference'; -describe('Reference', () => { +describe('Reference', () => +{ - it('Should parse the reference: Gen 1:1', () => { - let ref = new Reference("Gen 1:1").toString(); - expect(ref).toBe('Genesis 1:1'); + it('Should parse the reference: Gen 1:1', () => + { + let ref = new Reference("Gen 1:1").toString(); + expect(ref).toBe('Genesis 1:1'); + }); + + it('Should parse the reference: Gen 1:1-11', () => + { + let ref = new Reference("Gen 1:1-11").toString(); + expect(ref).toBe('Genesis 1:1 - 11'); + }); + + it('Should parse the reference: Gen 1-2', () => + { + let ref = new Reference("Gen 1-2").toString(); + expect(ref).toBe('Genesis 1:1 - 2:*'); + }); + + it('Should parse the reference: John 3:16', () => + { + let ref = new Reference("John 3:16").toString(); + expect(ref).toBe('John 3:16'); + }); + + it('Should parse the reference: John 3-6', () => + { + let ref = new Reference("Jn 3-6").toString(); + expect(ref).toBe('John 3:1 - 6:*'); + }); + + it('Should parse the reference: 1 Corinthians 3:5-6:5', () => + { + let ref = new Reference("1 Corinthians 3:5-6:5").toString(); + expect(ref).toBe('1 Corinthians 3:5 - 6:5'); + }); + + it('Should parse the reference: 2 Samuel 5:5-6:5', () => + { + expect(new Reference("II sam 5:5-6:5").toString()).toBe('2 Samuel 5:5 - 6:5'); + }); + + let booknames = [ + {"abbr": "gen", "actual": "Genesis"}, + {"abbr": "ge", "actual": "Genesis"}, + {"abbr": "genesis", "actual": "Genesis"}, + {"abbr": "gn", "actual": "Genesis"}, + {"abbr": "exodus", "actual": "Exodus"}, + {"abbr": "ex", "actual": "Exodus"}, + {"abbr": "exo", "actual": "Exodus"}, + {"abbr": "exod", "actual": "Exodus"}, + {"abbr": "exd", "actual": "Exodus"}, + {"abbr": "leviticus", "actual": "Leviticus"}, + {"abbr": "lev", "actual": "Leviticus"}, + {"abbr": "le", "actual": "Leviticus"}, + {"abbr": "levi", "actual": "Leviticus"}, + {"abbr": "lv", "actual": "Leviticus"}, + {"abbr": "numbers", "actual": "Numbers"}, + {"abbr": "num", "actual": "Numbers"}, + {"abbr": "nu", "actual": "Numbers"}, + {"abbr": "numb", "actual": "Numbers"}, + {"abbr": "number", "actual": "Numbers"}, + {"abbr": "deuteronomy", "actual": "Deuteronomy"}, + {"abbr": "deut", "actual": "Deuteronomy"}, + {"abbr": "de", "actual": "Deuteronomy"}, + {"abbr": "dt", "actual": "Deuteronomy"}, + {"abbr": "deu", "actual": "Deuteronomy"}, + {"abbr": "joshua", "actual": "Joshua"}, + {"abbr": "josh", "actual": "Joshua"}, + {"abbr": "jos", "actual": "Joshua"}, + {"abbr": "judges", "actual": "Judges"}, + {"abbr": "jud", "actual": "Judges"}, + {"abbr": "jdg", "actual": "Judges"}, + {"abbr": "judg", "actual": "Judges"}, + {"abbr": "ruth", "actual": "Ruth"}, + {"abbr": "ru", "actual": "Ruth"}, + {"abbr": "1 samuel", "actual": "1 Samuel"}, + {"abbr": "1 sa", "actual": "1 Samuel"}, + {"abbr": "1 sam", "actual": "1 Samuel"}, + {"abbr": "1 sml", "actual": "1 Samuel"}, + {"abbr": "i samuel", "actual": "1 Samuel"}, + {"abbr": "i sa", "actual": "1 Samuel"}, + {"abbr": "i sam", "actual": "1 Samuel"}, + {"abbr": "i sml", "actual": "1 Samuel"}, + {"abbr": "1st samuel", "actual": "1 Samuel"}, + {"abbr": "1st sa", "actual": "1 Samuel"}, + {"abbr": "1st sam", "actual": "1 Samuel"}, + {"abbr": "1st sml", "actual": "1 Samuel"}, + {"abbr": "first samuel", "actual": "1 Samuel"}, + {"abbr": "first sa", "actual": "1 Samuel"}, + {"abbr": "first sam", "actual": "1 Samuel"}, + {"abbr": "first sml", "actual": "1 Samuel"}, + {"abbr": "2 samuel", "actual": "2 Samuel"}, + {"abbr": "2 sa", "actual": "2 Samuel"}, + {"abbr": "2 sam", "actual": "2 Samuel"}, + {"abbr": "2 sml", "actual": "2 Samuel"}, + {"abbr": "ii samuel", "actual": "2 Samuel"}, + {"abbr": "ii sa", "actual": "2 Samuel"}, + {"abbr": "ii sam", "actual": "2 Samuel"}, + {"abbr": "ii sml", "actual": "2 Samuel"}, + {"abbr": "2nd samuel", "actual": "2 Samuel"}, + {"abbr": "2nd sa", "actual": "2 Samuel"}, + {"abbr": "2nd sam", "actual": "2 Samuel"}, + {"abbr": "2nd sml", "actual": "2 Samuel"}, + {"abbr": "second samuel", "actual": "2 Samuel"}, + {"abbr": "second sa", "actual": "2 Samuel"}, + {"abbr": "second sam", "actual": "2 Samuel"}, + {"abbr": "second sml", "actual": "2 Samuel"}, + {"abbr": "sec samuel", "actual": "2 Samuel"}, + {"abbr": "sec sa", "actual": "2 Samuel"}, + {"abbr": "sec sam", "actual": "2 Samuel"}, + {"abbr": "sec sml", "actual": "2 Samuel"}, + {"abbr": "1 kings", "actual": "1 Kings"}, + {"abbr": "1 king", "actual": "1 Kings"}, + {"abbr": "1 kgs", "actual": "1 Kings"}, + {"abbr": "1 kn", "actual": "1 Kings"}, + {"abbr": "1 k", "actual": "1 Kings"}, + {"abbr": "1 ki", "actual": "1 Kings"}, + {"abbr": "i kings", "actual": "1 Kings"}, + {"abbr": "i king", "actual": "1 Kings"}, + {"abbr": "i kgs", "actual": "1 Kings"}, + {"abbr": "i kn", "actual": "1 Kings"}, + {"abbr": "i k", "actual": "1 Kings"}, + {"abbr": "i ki", "actual": "1 Kings"}, + {"abbr": "1st kings", "actual": "1 Kings"}, + {"abbr": "1st king", "actual": "1 Kings"}, + {"abbr": "1st kgs", "actual": "1 Kings"}, + {"abbr": "1st kn", "actual": "1 Kings"}, + {"abbr": "1st k", "actual": "1 Kings"}, + {"abbr": "1st ki", "actual": "1 Kings"}, + {"abbr": "first kings", "actual": "1 Kings"}, + {"abbr": "first king", "actual": "1 Kings"}, + {"abbr": "first kgs", "actual": "1 Kings"}, + {"abbr": "first kn", "actual": "1 Kings"}, + {"abbr": "first k", "actual": "1 Kings"}, + {"abbr": "first ki", "actual": "1 Kings"}, + {"abbr": "2 Kings", "actual": "2 Kings"}, + {"abbr": "2 king", "actual": "2 Kings"}, + {"abbr": "2 kgs", "actual": "2 Kings"}, + {"abbr": "2 kn", "actual": "2 Kings"}, + {"abbr": "2 k", "actual": "2 Kings"}, + {"abbr": "2 ki", "actual": "2 Kings"}, + {"abbr": "ii kings", "actual": "2 Kings"}, + {"abbr": "ii king", "actual": "2 Kings"}, + {"abbr": "ii kgs", "actual": "2 Kings"}, + {"abbr": "ii kn", "actual": "2 Kings"}, + {"abbr": "ii k", "actual": "2 Kings"}, + {"abbr": "ii ki", "actual": "2 Kings"}, + {"abbr": "2nd kings", "actual": "2 Kings"}, + {"abbr": "2nd king", "actual": "2 Kings"}, + {"abbr": "2nd kgs", "actual": "2 Kings"}, + {"abbr": "2nd kn", "actual": "2 Kings"}, + {"abbr": "2nd k", "actual": "2 Kings"}, + {"abbr": "2nd ki", "actual": "2 Kings"}, + {"abbr": "second kings", "actual": "2 Kings"}, + {"abbr": "second king", "actual": "2 Kings"}, + {"abbr": "second kgs", "actual": "2 Kings"}, + {"abbr": "second kn", "actual": "2 Kings"}, + {"abbr": "second k", "actual": "2 Kings"}, + {"abbr": "second ki", "actual": "2 Kings"}, + {"abbr": "sec kings", "actual": "2 Kings"}, + {"abbr": "sec king", "actual": "2 Kings"}, + {"abbr": "sec kgs", "actual": "2 Kings"}, + {"abbr": "sec kn", "actual": "2 Kings"}, + {"abbr": "sec k", "actual": "2 Kings"}, + {"abbr": "sec ki", "actual": "2 Kings"}, + {"abbr": "2 Chronicles", "actual": "2 Chronicles"}, + {"abbr": "2 chronicles", "actual": "2 Chronicles"}, + {"abbr": "2 chron", "actual": "2 Chronicles"}, + {"abbr": "2 ch", "actual": "2 Chronicles"}, + {"abbr": "2 chr", "actual": "2 Chronicles"}, + {"abbr": "ii Chronicles", "actual": "2 Chronicles"}, + {"abbr": "ii chronicles", "actual": "2 Chronicles"}, + {"abbr": "ii chron", "actual": "2 Chronicles"}, + {"abbr": "ii ch", "actual": "2 Chronicles"}, + {"abbr": "ii chr", "actual": "2 Chronicles"}, + {"abbr": "2nd Chronicles", "actual": "2 Chronicles"}, + {"abbr": "2nd chronicles", "actual": "2 Chronicles"}, + {"abbr": "2nd chron", "actual": "2 Chronicles"}, + {"abbr": "2nd ch", "actual": "2 Chronicles"}, + {"abbr": "2nd chr", "actual": "2 Chronicles"}, + {"abbr": "second Chronicles", "actual": "2 Chronicles"}, + {"abbr": "second chronicles", "actual": "2 Chronicles"}, + {"abbr": "second chron", "actual": "2 Chronicles"}, + {"abbr": "second ch", "actual": "2 Chronicles"}, + {"abbr": "second chr", "actual": "2 Chronicles"}, + {"abbr": "sec Chronicles", "actual": "2 Chronicles"}, + {"abbr": "sec chronicles", "actual": "2 Chronicles"}, + {"abbr": "sec chron", "actual": "2 Chronicles"}, + {"abbr": "sec ch", "actual": "2 Chronicles"}, + {"abbr": "sec chr", "actual": "2 Chronicles"}, + {"abbr": "1 Chronicles", "actual": "1 Chronicles"}, + {"abbr": "1 chronicles", "actual": "1 Chronicles"}, + {"abbr": "1 chron", "actual": "1 Chronicles"}, + {"abbr": "1 ch", "actual": "1 Chronicles"}, + {"abbr": "1 chr", "actual": "1 Chronicles"}, + {"abbr": "i Chronicles", "actual": "1 Chronicles"}, + {"abbr": "i chronicles", "actual": "1 Chronicles"}, + {"abbr": "i chron", "actual": "1 Chronicles"}, + {"abbr": "i ch", "actual": "1 Chronicles"}, + {"abbr": "i chr", "actual": "1 Chronicles"}, + {"abbr": "1st Chronicles", "actual": "1 Chronicles"}, + {"abbr": "1st chronicles", "actual": "1 Chronicles"}, + {"abbr": "1st chron", "actual": "1 Chronicles"}, + {"abbr": "1st ch", "actual": "1 Chronicles"}, + {"abbr": "1st chr", "actual": "1 Chronicles"}, + {"abbr": "first Chronicles", "actual": "1 Chronicles"}, + {"abbr": "first chronicles", "actual": "1 Chronicles"}, + {"abbr": "first chron", "actual": "1 Chronicles"}, + {"abbr": "first ch", "actual": "1 Chronicles"}, + {"abbr": "first chr", "actual": "1 Chronicles"}, + {"abbr": "ezra", "actual": "Ezra"}, + {"abbr": "ezr", "actual": "Ezra"}, + {"abbr": "nehemiah", "actual": "Nehemiah"}, + {"abbr": "neh", "actual": "Nehemiah"}, + {"abbr": "ne", "actual": "Nehemiah"}, + {"abbr": "nehamiah", "actual": "Nehemiah"}, + {"abbr": "esther", "actual": "Esther"}, + {"abbr": "est", "actual": "Esther"}, + {"abbr": "es", "actual": "Esther"}, + {"abbr": "esth", "actual": "Esther"}, + {"abbr": "job", "actual": "Job"}, + {"abbr": "jo", "actual": "Job"}, + {"abbr": "jb", "actual": "Job"}, + {"abbr": "psalms", "actual": "Psalm"}, + {"abbr": "ps", "actual": "Psalm"}, + {"abbr": "psa", "actual": "Psalm"}, + {"abbr": "psalm", "actual": "Psalm"}, + {"abbr": "psm", "actual": "Psalm"}, + {"abbr": "proverbs", "actual": "Proverbs"}, + {"abbr": "prov", "actual": "Proverbs"}, + {"abbr": "pr", "actual": "Proverbs"}, + {"abbr": "pro", "actual": "Proverbs"}, + {"abbr": "proverb", "actual": "Proverbs"}, + {"abbr": "prv", "actual": "Proverbs"}, + {"abbr": "prvbs", "actual": "Proverbs"}, + {"abbr": "ecclesiastes", "actual": "Ecclesiastes"}, + {"abbr": "eccl", "actual": "Ecclesiastes"}, + {"abbr": "ecc", "actual": "Ecclesiastes"}, + {"abbr": "eccles", "actual": "Ecclesiastes"}, + {"abbr": "ec", "actual": "Ecclesiastes"}, + {"abbr": "ecl", "actual": "Ecclesiastes"}, + {"abbr": "ecclesiaste", "actual": "Ecclesiastes"}, + {"abbr": "song of solomon", "actual": "Song of Solomon"}, + {"abbr": "song of songs", "actual": "Song of Solomon"}, + {"abbr": "sos", "actual": "Song of Solomon"}, + {"abbr": "ss", "actual": "Song of Solomon"}, + {"abbr": "son", "actual": "Song of Solomon"}, + {"abbr": "so", "actual": "Song of Solomon"}, + {"abbr": "song", "actual": "Song of Solomon"}, + {"abbr": "songs", "actual": "Song of Solomon"}, + {"abbr": "isaiah", "actual": "Isaiah"}, + {"abbr": "is", "actual": "Isaiah"}, + {"abbr": "isah", "actual": "Isaiah"}, + {"abbr": "isai", "actual": "Isaiah"}, + {"abbr": "ia", "actual": "Isaiah"}, + {"abbr": "jerimiah", "actual": "Jeremiah"}, + {"abbr": "jeremiah", "actual": "Jeremiah"}, + {"abbr": "jer", "actual": "Jeremiah"}, + {"abbr": "je", "actual": "Jeremiah"}, + {"abbr": "jere", "actual": "Jeremiah"}, + {"abbr": "lamentations", "actual": "Lamentations"}, + {"abbr": "lam", "actual": "Lamentations"}, + {"abbr": "la", "actual": "Lamentations"}, + {"abbr": "lamentation", "actual": "Lamentations"}, + ]; + + for (let bk of booknames) + { + it('Should parse the references: ' + bk.abbr, () => + { + let book = Reference.parseBook(bk.abbr); + expect(book.bookname).toBe(bk.actual); + for (let i = 1; i <= book.lastchapter; i++) + expect(new Reference(bk.abbr + ' ' + i).toString()).toBe(bk.actual + ' ' + i + ":1 - *"); + + for (let i = 1; i < book.lastchapter; i++) + { + expect(new Reference(bk.abbr + ' ' + i + '-' + (i + 1)).toString()).toBe(bk.actual + ' ' + i + ":1 - " + (i + 1) + ":*"); + expect(new Reference(bk.abbr + ' ' + i + ':3-' + (i + 1) + ":6").toString()).toBe(bk.actual + ' ' + i + ":3 - " + (i + 1) + ":6"); + } + + expect(new Reference(bk.abbr + ' 1:4-2:5').toString()).toBe(bk.actual + ' 1:4 - 2:5'); + expect(new Reference(bk.abbr + ' 1:1 - 5').toString()).toBe(bk.actual + ' 1:1 - 5'); + expect(new Reference(bk.abbr + ' 1:4 - 5').toString()).toBe(bk.actual + ' 1:4 - 5'); }); + } + let refs = [ + {"src": "2 sam 3:4-6:8", "actual": "2 Samuel 3:4 - 6:8"}, + //{ "src": "gen 50 - ex 2", "actual": "Genesis 50:1 - Exodus 2:*" }, + ]; - it('Should parse the reference: Gen 1:1-11', () => { - let ref = new Reference("Gen 1:1-11").toString(); - expect(ref).toBe('Genesis 1:1 - 11'); + for (let ref of refs) + { + it('Should parse the reference: ' + ref.src, () => + { + expect(new Reference(ref.src).toString()).toBe(ref.actual); }); - - it('Should parse the reference: Gen 1-2', () => { - let ref = new Reference("Gen 1-2").toString(); - expect(ref).toBe('Genesis 1:1 - 2:*'); - }); - - it('Should parse the reference: John 3:16', () => { - let ref = new Reference("John 3:16").toString(); - expect(ref).toBe('John 3:16'); - }); - - it('Should parse the reference: John 3-6', () => { - let ref = new Reference("Jn 3-6").toString(); - expect(ref).toBe('John 3:1 - 6:*'); - }); - - it('Should parse the reference: 1 Corinthians 3:5-6:5', () => { - let ref = new Reference("1 Corinthians 3:5-6:5").toString(); - expect(ref).toBe('1 Corinthians 3:5 - 6:5'); - }); - - it('Should parse the reference: 2 Samuel 5:5-6:5', () => { - expect(new Reference("II sam 5:5-6:5").toString()).toBe('2 Samuel 5:5 - 6:5'); - }); - - let booknames = [ - { "abbr": "gen", "actual": "Genesis" }, - { "abbr": "ge", "actual": "Genesis" }, - { "abbr": "genesis", "actual": "Genesis" }, - { "abbr": "gn", "actual": "Genesis" }, - { "abbr": "exodus", "actual": "Exodus" }, - { "abbr": "ex", "actual": "Exodus" }, - { "abbr": "exo", "actual": "Exodus" }, - { "abbr": "exod", "actual": "Exodus" }, - { "abbr": "exd", "actual": "Exodus" }, - { "abbr": "leviticus", "actual": "Leviticus" }, - { "abbr": "lev", "actual": "Leviticus" }, - { "abbr": "le", "actual": "Leviticus" }, - { "abbr": "levi", "actual": "Leviticus" }, - { "abbr": "lv", "actual": "Leviticus" }, - { "abbr": "numbers", "actual": "Numbers" }, - { "abbr": "num", "actual": "Numbers" }, - { "abbr": "nu", "actual": "Numbers" }, - { "abbr": "numb", "actual": "Numbers" }, - { "abbr": "number", "actual": "Numbers" }, - { "abbr": "deuteronomy", "actual": "Deuteronomy" }, - { "abbr": "deut", "actual": "Deuteronomy" }, - { "abbr": "de", "actual": "Deuteronomy" }, - { "abbr": "dt", "actual": "Deuteronomy" }, - { "abbr": "deu", "actual": "Deuteronomy" }, - { "abbr": "joshua", "actual": "Joshua" }, - { "abbr": "josh", "actual": "Joshua" }, - { "abbr": "jos", "actual": "Joshua" }, - { "abbr": "judges", "actual": "Judges" }, - { "abbr": "jud", "actual": "Judges" }, - { "abbr": "jdg", "actual": "Judges" }, - { "abbr": "judg", "actual": "Judges" }, - { "abbr": "ruth", "actual": "Ruth" }, - { "abbr": "ru", "actual": "Ruth" }, - { "abbr": "1 samuel", "actual": "1 Samuel" }, - { "abbr": "1 sa", "actual": "1 Samuel" }, - { "abbr": "1 sam", "actual": "1 Samuel" }, - { "abbr": "1 sml", "actual": "1 Samuel" }, - { "abbr": "i samuel", "actual": "1 Samuel" }, - { "abbr": "i sa", "actual": "1 Samuel" }, - { "abbr": "i sam", "actual": "1 Samuel" }, - { "abbr": "i sml", "actual": "1 Samuel" }, - { "abbr": "1st samuel", "actual": "1 Samuel" }, - { "abbr": "1st sa", "actual": "1 Samuel" }, - { "abbr": "1st sam", "actual": "1 Samuel" }, - { "abbr": "1st sml", "actual": "1 Samuel" }, - { "abbr": "first samuel", "actual": "1 Samuel" }, - { "abbr": "first sa", "actual": "1 Samuel" }, - { "abbr": "first sam", "actual": "1 Samuel" }, - { "abbr": "first sml", "actual": "1 Samuel" }, - { "abbr": "2 samuel", "actual": "2 Samuel" }, - { "abbr": "2 sa", "actual": "2 Samuel" }, - { "abbr": "2 sam", "actual": "2 Samuel" }, - { "abbr": "2 sml", "actual": "2 Samuel" }, - { "abbr": "ii samuel", "actual": "2 Samuel" }, - { "abbr": "ii sa", "actual": "2 Samuel" }, - { "abbr": "ii sam", "actual": "2 Samuel" }, - { "abbr": "ii sml", "actual": "2 Samuel" }, - { "abbr": "2nd samuel", "actual": "2 Samuel" }, - { "abbr": "2nd sa", "actual": "2 Samuel" }, - { "abbr": "2nd sam", "actual": "2 Samuel" }, - { "abbr": "2nd sml", "actual": "2 Samuel" }, - { "abbr": "second samuel", "actual": "2 Samuel" }, - { "abbr": "second sa", "actual": "2 Samuel" }, - { "abbr": "second sam", "actual": "2 Samuel" }, - { "abbr": "second sml", "actual": "2 Samuel" }, - { "abbr": "sec samuel", "actual": "2 Samuel" }, - { "abbr": "sec sa", "actual": "2 Samuel" }, - { "abbr": "sec sam", "actual": "2 Samuel" }, - { "abbr": "sec sml", "actual": "2 Samuel" }, - { "abbr": "1 kings", "actual": "1 Kings" }, - { "abbr": "1 king", "actual": "1 Kings" }, - { "abbr": "1 kgs", "actual": "1 Kings" }, - { "abbr": "1 kn", "actual": "1 Kings" }, - { "abbr": "1 k", "actual": "1 Kings" }, - { "abbr": "1 ki", "actual": "1 Kings" }, - { "abbr": "i kings", "actual": "1 Kings" }, - { "abbr": "i king", "actual": "1 Kings" }, - { "abbr": "i kgs", "actual": "1 Kings" }, - { "abbr": "i kn", "actual": "1 Kings" }, - { "abbr": "i k", "actual": "1 Kings" }, - { "abbr": "i ki", "actual": "1 Kings" }, - { "abbr": "1st kings", "actual": "1 Kings" }, - { "abbr": "1st king", "actual": "1 Kings" }, - { "abbr": "1st kgs", "actual": "1 Kings" }, - { "abbr": "1st kn", "actual": "1 Kings" }, - { "abbr": "1st k", "actual": "1 Kings" }, - { "abbr": "1st ki", "actual": "1 Kings" }, - { "abbr": "first kings", "actual": "1 Kings" }, - { "abbr": "first king", "actual": "1 Kings" }, - { "abbr": "first kgs", "actual": "1 Kings" }, - { "abbr": "first kn", "actual": "1 Kings" }, - { "abbr": "first k", "actual": "1 Kings" }, - { "abbr": "first ki", "actual": "1 Kings" }, - { "abbr": "2 Kings", "actual": "2 Kings" }, - { "abbr": "2 king", "actual": "2 Kings" }, - { "abbr": "2 kgs", "actual": "2 Kings" }, - { "abbr": "2 kn", "actual": "2 Kings" }, - { "abbr": "2 k", "actual": "2 Kings" }, - { "abbr": "2 ki", "actual": "2 Kings" }, - { "abbr": "ii kings", "actual": "2 Kings" }, - { "abbr": "ii king", "actual": "2 Kings" }, - { "abbr": "ii kgs", "actual": "2 Kings" }, - { "abbr": "ii kn", "actual": "2 Kings" }, - { "abbr": "ii k", "actual": "2 Kings" }, - { "abbr": "ii ki", "actual": "2 Kings" }, - { "abbr": "2nd kings", "actual": "2 Kings" }, - { "abbr": "2nd king", "actual": "2 Kings" }, - { "abbr": "2nd kgs", "actual": "2 Kings" }, - { "abbr": "2nd kn", "actual": "2 Kings" }, - { "abbr": "2nd k", "actual": "2 Kings" }, - { "abbr": "2nd ki", "actual": "2 Kings" }, - { "abbr": "second kings", "actual": "2 Kings" }, - { "abbr": "second king", "actual": "2 Kings" }, - { "abbr": "second kgs", "actual": "2 Kings" }, - { "abbr": "second kn", "actual": "2 Kings" }, - { "abbr": "second k", "actual": "2 Kings" }, - { "abbr": "second ki", "actual": "2 Kings" }, - { "abbr": "sec kings", "actual": "2 Kings" }, - { "abbr": "sec king", "actual": "2 Kings" }, - { "abbr": "sec kgs", "actual": "2 Kings" }, - { "abbr": "sec kn", "actual": "2 Kings" }, - { "abbr": "sec k", "actual": "2 Kings" }, - { "abbr": "sec ki", "actual": "2 Kings" }, - { "abbr": "2 Chronicles", "actual": "2 Chronicles" }, - { "abbr": "2 chronicles", "actual": "2 Chronicles" }, - { "abbr": "2 chron", "actual": "2 Chronicles" }, - { "abbr": "2 ch", "actual": "2 Chronicles" }, - { "abbr": "2 chr", "actual": "2 Chronicles" }, - { "abbr": "ii Chronicles", "actual": "2 Chronicles" }, - { "abbr": "ii chronicles", "actual": "2 Chronicles" }, - { "abbr": "ii chron", "actual": "2 Chronicles" }, - { "abbr": "ii ch", "actual": "2 Chronicles" }, - { "abbr": "ii chr", "actual": "2 Chronicles" }, - { "abbr": "2nd Chronicles", "actual": "2 Chronicles" }, - { "abbr": "2nd chronicles", "actual": "2 Chronicles" }, - { "abbr": "2nd chron", "actual": "2 Chronicles" }, - { "abbr": "2nd ch", "actual": "2 Chronicles" }, - { "abbr": "2nd chr", "actual": "2 Chronicles" }, - { "abbr": "second Chronicles", "actual": "2 Chronicles" }, - { "abbr": "second chronicles", "actual": "2 Chronicles" }, - { "abbr": "second chron", "actual": "2 Chronicles" }, - { "abbr": "second ch", "actual": "2 Chronicles" }, - { "abbr": "second chr", "actual": "2 Chronicles" }, - { "abbr": "sec Chronicles", "actual": "2 Chronicles" }, - { "abbr": "sec chronicles", "actual": "2 Chronicles" }, - { "abbr": "sec chron", "actual": "2 Chronicles" }, - { "abbr": "sec ch", "actual": "2 Chronicles" }, - { "abbr": "sec chr", "actual": "2 Chronicles" }, - { "abbr": "1 Chronicles", "actual": "1 Chronicles" }, - { "abbr": "1 chronicles", "actual": "1 Chronicles" }, - { "abbr": "1 chron", "actual": "1 Chronicles" }, - { "abbr": "1 ch", "actual": "1 Chronicles" }, - { "abbr": "1 chr", "actual": "1 Chronicles" }, - { "abbr": "i Chronicles", "actual": "1 Chronicles" }, - { "abbr": "i chronicles", "actual": "1 Chronicles" }, - { "abbr": "i chron", "actual": "1 Chronicles" }, - { "abbr": "i ch", "actual": "1 Chronicles" }, - { "abbr": "i chr", "actual": "1 Chronicles" }, - { "abbr": "1st Chronicles", "actual": "1 Chronicles" }, - { "abbr": "1st chronicles", "actual": "1 Chronicles" }, - { "abbr": "1st chron", "actual": "1 Chronicles" }, - { "abbr": "1st ch", "actual": "1 Chronicles" }, - { "abbr": "1st chr", "actual": "1 Chronicles" }, - { "abbr": "first Chronicles", "actual": "1 Chronicles" }, - { "abbr": "first chronicles", "actual": "1 Chronicles" }, - { "abbr": "first chron", "actual": "1 Chronicles" }, - { "abbr": "first ch", "actual": "1 Chronicles" }, - { "abbr": "first chr", "actual": "1 Chronicles" }, - { "abbr": "ezra", "actual": "Ezra" }, - { "abbr": "ezr", "actual": "Ezra" }, - { "abbr": "nehemiah", "actual": "Nehemiah" }, - { "abbr": "neh", "actual": "Nehemiah" }, - { "abbr": "ne", "actual": "Nehemiah" }, - { "abbr": "nehamiah", "actual": "Nehemiah" }, - { "abbr": "esther", "actual": "Esther" }, - { "abbr": "est", "actual": "Esther" }, - { "abbr": "es", "actual": "Esther" }, - { "abbr": "esth", "actual": "Esther" }, - { "abbr": "job", "actual": "Job" }, - { "abbr": "jo", "actual": "Job" }, - { "abbr": "jb", "actual": "Job" }, - { "abbr": "psalms", "actual": "Psalm" }, - { "abbr": "ps", "actual": "Psalm" }, - { "abbr": "psa", "actual": "Psalm" }, - { "abbr": "psalm", "actual": "Psalm" }, - { "abbr": "psm", "actual": "Psalm" }, - { "abbr": "proverbs", "actual": "Proverbs" }, - { "abbr": "prov", "actual": "Proverbs" }, - { "abbr": "pr", "actual": "Proverbs" }, - { "abbr": "pro", "actual": "Proverbs" }, - { "abbr": "proverb", "actual": "Proverbs" }, - { "abbr": "prv", "actual": "Proverbs" }, - { "abbr": "prvbs", "actual": "Proverbs" }, - { "abbr": "ecclesiastes", "actual": "Ecclesiastes" }, - { "abbr": "eccl", "actual": "Ecclesiastes" }, - { "abbr": "ecc", "actual": "Ecclesiastes" }, - { "abbr": "eccles", "actual": "Ecclesiastes" }, - { "abbr": "ec", "actual": "Ecclesiastes" }, - { "abbr": "ecl", "actual": "Ecclesiastes" }, - { "abbr": "ecclesiaste", "actual": "Ecclesiastes" }, - { "abbr": "song of solomon", "actual": "Song of Solomon" }, - { "abbr": "song of songs", "actual": "Song of Solomon" }, - { "abbr": "sos", "actual": "Song of Solomon" }, - { "abbr": "ss", "actual": "Song of Solomon" }, - { "abbr": "son", "actual": "Song of Solomon" }, - { "abbr": "so", "actual": "Song of Solomon" }, - { "abbr": "song", "actual": "Song of Solomon" }, - { "abbr": "songs", "actual": "Song of Solomon" }, - { "abbr": "isaiah", "actual": "Isaiah" }, - { "abbr": "is", "actual": "Isaiah" }, - { "abbr": "isah", "actual": "Isaiah" }, - { "abbr": "isai", "actual": "Isaiah" }, - { "abbr": "ia", "actual": "Isaiah" }, - { "abbr": "jerimiah", "actual": "Jeremiah" }, - { "abbr": "jeremiah", "actual": "Jeremiah" }, - { "abbr": "jer", "actual": "Jeremiah" }, - { "abbr": "je", "actual": "Jeremiah" }, - { "abbr": "jere", "actual": "Jeremiah" }, - { "abbr": "lamentations", "actual": "Lamentations" }, - { "abbr": "lam", "actual": "Lamentations" }, - { "abbr": "la", "actual": "Lamentations" }, - { "abbr": "lamentation", "actual": "Lamentations" }, - ]; - - for (let bk of booknames) { - it('Should parse the references: ' + bk.abbr, () => { - let book = Reference.parseBook(bk.abbr); - expect(book.bookname).toBe(bk.actual); - for (let i = 1; i <= book.lastchapter; i++) - expect(new Reference(bk.abbr + ' ' + i).toString()).toBe(bk.actual + ' ' + i + ":1 - *"); - - for (let i = 1; i < book.lastchapter; i++) { - expect(new Reference(bk.abbr + ' ' + i + '-' + (i + 1)).toString()).toBe(bk.actual + ' ' + i + ":1 - " + (i + 1) + ":*"); - expect(new Reference(bk.abbr + ' ' + i + ':3-' + (i + 1)+":6").toString()).toBe(bk.actual + ' ' + i + ":3 - " + (i + 1) + ":6"); - } - - expect(new Reference(bk.abbr + ' 1:4-2:5').toString()).toBe(bk.actual + ' 1:4 - 2:5'); - expect(new Reference(bk.abbr + ' 1:1 - 5').toString()).toBe(bk.actual + ' 1:1 - 5'); - expect(new Reference(bk.abbr + ' 1:4 - 5').toString()).toBe(bk.actual + ' 1:4 - 5'); - }); - } - let refs = [ - { "src": "2 sam 3:4-6:8", "actual": "2 Samuel 3:4 - 6:8" }, - //{ "src": "gen 50 - ex 2", "actual": "Genesis 50:1 - Exodus 2:*" }, - ]; - - for (let ref of refs) { - it('Should parse the reference: ' + ref.src, () => { - expect(new Reference(ref.src).toString()).toBe(ref.actual); - }); - } + } }); diff --git a/DynamicBibleIonic/src/bible-service.spec.ts b/DynamicBibleIonic/src/bible-service.spec.ts index ce3c92a3..cec6c977 100644 --- a/DynamicBibleIonic/src/bible-service.spec.ts +++ b/DynamicBibleIonic/src/bible-service.spec.ts @@ -1,312 +1,98 @@ -import { getTestBed, TestBed, inject } from '@angular/core/testing'; -import { XHRBackend, BaseRequestOptions, HttpModule, Http, } from '@angular/http'; -import { MockBackend } from '@angular/http/testing'; -import { BibleService } from './bible-service'; -import { Reference } from './Reference'; +import {getTestBed, TestBed, inject} from '@angular/core/testing'; +import {XHRBackend, BaseRequestOptions, HttpModule, Http,} from '@angular/http'; +import {MockBackend} from '@angular/http/testing'; +import {BibleService} from './bible-service'; +import {Reference} from './Reference'; -describe('Bible Service', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpModule], - providers: [ - BibleService, - { - provide: Http, - useFactory: function (backend, defaultOptions) { - return new Http(backend, defaultOptions); - }, - deps: [MockBackend, BaseRequestOptions] - }, - MockBackend, - BaseRequestOptions - ] - }); +describe('Bible Service', () => +{ + beforeEach(() => + { + TestBed.configureTestingModule({ + imports: [HttpModule], + providers: [ + BibleService, + { + provide: Http, + useFactory: function (backend, defaultOptions) + { + return new Http(backend, defaultOptions); + }, + deps: [MockBackend, BaseRequestOptions] + }, + MockBackend, + BaseRequestOptions + ] }); + }); - it('Should get the verse: Gen 1:1', () => { - let svc: BibleService = getTestBed().get(BibleService); - let ref = new Reference("Gen 1:1").Section; - var r = svc.getResult(ref); + it('Should get the verse: Gen 1:1', () => + { + let svc: BibleService = getTestBed().get(BibleService); + let ref = new Reference("Gen 1:1").Section; + var r = svc.getResult(ref); - expect(r.msg).toBe(':)'); - expect(r.ref).toBe('Genesis 1:1'); - expect(r.status).toBe(0); - expect(r.testament).toBe("old"); + expect(r.msg).toBe(':)'); + expect(r.ref).toBe('Genesis 1:1'); + expect(r.status).toBe(0); + expect(r.testament).toBe("old"); - expect(r.cs.length).toBe(1); - expect(r.cs[0].vss.length).toBe(1); - expect(r.cs[0].vss[0].w.length).toBe(9); - expect(r.cs[0].vss[0].w[0].t).toBe("In the"); - }); + expect(r.cs.length).toBe(1); + expect(r.cs[0].vss.length).toBe(1); + expect(r.cs[0].vss[0].w.length).toBe(9); + expect(r.cs[0].vss[0].w[0].t).toBe("In the"); + }); - it('Should get the passage: Gen 1:1-9', () => { - let svc: BibleService = getTestBed().get(BibleService); - let ref = new Reference("Gen 1:1-9").Section; - var r = svc.getResult(ref); + it('Should get the passage: Gen 1:1-9', () => + { + let svc: BibleService = getTestBed().get(BibleService); + let ref = new Reference("Gen 1:1-9").Section; + var r = svc.getResult(ref); - expect(r.msg).toBe(':)'); - expect(r.ref).toBe('Genesis 1:1 - 9'); - expect(r.status).toBe(0); - expect(r.testament).toBe("old"); + expect(r.msg).toBe(':)'); + expect(r.ref).toBe('Genesis 1:1 - 9'); + expect(r.status).toBe(0); + expect(r.testament).toBe("old"); - expect(r.cs.length).toBe(1); - expect(r.cs[0].vss.length).toBe(9); - expect(r.cs[0].vss[0].w.length).toBe(9); - expect(r.cs[0].vss[0].w[0].t).toBe("In the"); - }); + expect(r.cs.length).toBe(1); + expect(r.cs[0].vss.length).toBe(9); + expect(r.cs[0].vss[0].w.length).toBe(9); + expect(r.cs[0].vss[0].w[0].t).toBe("In the"); + }); - it('Should return an error status', () => { - let svc: BibleService = getTestBed().get(BibleService); - let ref = new Reference("Gen 100:1").Section; - var r = svc.getResult(ref); + it('Should return an error status', () => + { + let svc: BibleService = getTestBed().get(BibleService); + let ref = new Reference("Gen 100:1").Section; + var r = svc.getResult(ref); - expect(r.msg).toBe('Unable to retrieve bible passage Genesis 100:1.'); - expect(r.ref).toBe("Genesis 100:1"); - expect(r.status).toBe(-1); - expect(r.testament).toBe(''); + expect(r.msg).toBe('Unable to retrieve bible passage Genesis 100:1.'); + expect(r.ref).toBe("Genesis 100:1"); + expect(r.status).toBe(-1); + expect(r.testament).toBe(''); - }); + }); - let booknames = [ - { "abbr": "gen", "actual": "Genesis" }, - { "abbr": "ge", "actual": "Genesis" }, - { "abbr": "genesis", "actual": "Genesis" }, - { "abbr": "gn", "actual": "Genesis" }, - { "abbr": "exodus", "actual": "Exodus" }, - { "abbr": "ex", "actual": "Exodus" }, - { "abbr": "exo", "actual": "Exodus" }, - { "abbr": "exod", "actual": "Exodus" }, - { "abbr": "exd", "actual": "Exodus" }, - { "abbr": "leviticus", "actual": "Leviticus" }, - { "abbr": "lev", "actual": "Leviticus" }, - { "abbr": "le", "actual": "Leviticus" }, - { "abbr": "levi", "actual": "Leviticus" }, - { "abbr": "lv", "actual": "Leviticus" }, - { "abbr": "numbers", "actual": "Numbers" }, - { "abbr": "num", "actual": "Numbers" }, - { "abbr": "nu", "actual": "Numbers" }, - { "abbr": "numb", "actual": "Numbers" }, - { "abbr": "number", "actual": "Numbers" }, - { "abbr": "deuteronomy", "actual": "Deuteronomy" }, - { "abbr": "deut", "actual": "Deuteronomy" }, - { "abbr": "de", "actual": "Deuteronomy" }, - { "abbr": "dt", "actual": "Deuteronomy" }, - { "abbr": "deu", "actual": "Deuteronomy" }, - { "abbr": "joshua", "actual": "Joshua" }, - { "abbr": "josh", "actual": "Joshua" }, - { "abbr": "jos", "actual": "Joshua" }, - { "abbr": "judges", "actual": "Judges" }, - { "abbr": "jud", "actual": "Judges" }, - { "abbr": "jdg", "actual": "Judges" }, - { "abbr": "judg", "actual": "Judges" }, - { "abbr": "ruth", "actual": "Ruth" }, - { "abbr": "ru", "actual": "Ruth" }, - { "abbr": "1 samuel", "actual": "1 Samuel" }, - { "abbr": "1 sa", "actual": "1 Samuel" }, - { "abbr": "1 sam", "actual": "1 Samuel" }, - { "abbr": "1 sml", "actual": "1 Samuel" }, - { "abbr": "i samuel", "actual": "1 Samuel" }, - { "abbr": "i sa", "actual": "1 Samuel" }, - { "abbr": "i sam", "actual": "1 Samuel" }, - { "abbr": "i sml", "actual": "1 Samuel" }, - { "abbr": "1st samuel", "actual": "1 Samuel" }, - { "abbr": "1st sa", "actual": "1 Samuel" }, - { "abbr": "1st sam", "actual": "1 Samuel" }, - { "abbr": "1st sml", "actual": "1 Samuel" }, - { "abbr": "first samuel", "actual": "1 Samuel" }, - { "abbr": "first sa", "actual": "1 Samuel" }, - { "abbr": "first sam", "actual": "1 Samuel" }, - { "abbr": "first sml", "actual": "1 Samuel" }, - { "abbr": "2 samuel", "actual": "2 Samuel" }, - { "abbr": "2 sa", "actual": "2 Samuel" }, - { "abbr": "2 sam", "actual": "2 Samuel" }, - { "abbr": "2 sml", "actual": "2 Samuel" }, - { "abbr": "ii samuel", "actual": "2 Samuel" }, - { "abbr": "ii sa", "actual": "2 Samuel" }, - { "abbr": "ii sam", "actual": "2 Samuel" }, - { "abbr": "ii sml", "actual": "2 Samuel" }, - { "abbr": "2nd samuel", "actual": "2 Samuel" }, - { "abbr": "2nd sa", "actual": "2 Samuel" }, - { "abbr": "2nd sam", "actual": "2 Samuel" }, - { "abbr": "2nd sml", "actual": "2 Samuel" }, - { "abbr": "second samuel", "actual": "2 Samuel" }, - { "abbr": "second sa", "actual": "2 Samuel" }, - { "abbr": "second sam", "actual": "2 Samuel" }, - { "abbr": "second sml", "actual": "2 Samuel" }, - { "abbr": "sec samuel", "actual": "2 Samuel" }, - { "abbr": "sec sa", "actual": "2 Samuel" }, - { "abbr": "sec sam", "actual": "2 Samuel" }, - { "abbr": "sec sml", "actual": "2 Samuel" }, - { "abbr": "1 kings", "actual": "1 Kings" }, - { "abbr": "1 king", "actual": "1 Kings" }, - { "abbr": "1 kgs", "actual": "1 Kings" }, - { "abbr": "1 kn", "actual": "1 Kings" }, - { "abbr": "1 k", "actual": "1 Kings" }, - { "abbr": "1 ki", "actual": "1 Kings" }, - { "abbr": "i kings", "actual": "1 Kings" }, - { "abbr": "i king", "actual": "1 Kings" }, - { "abbr": "i kgs", "actual": "1 Kings" }, - { "abbr": "i kn", "actual": "1 Kings" }, - { "abbr": "i k", "actual": "1 Kings" }, - { "abbr": "i ki", "actual": "1 Kings" }, - { "abbr": "1st kings", "actual": "1 Kings" }, - { "abbr": "1st king", "actual": "1 Kings" }, - { "abbr": "1st kgs", "actual": "1 Kings" }, - { "abbr": "1st kn", "actual": "1 Kings" }, - { "abbr": "1st k", "actual": "1 Kings" }, - { "abbr": "1st ki", "actual": "1 Kings" }, - { "abbr": "first kings", "actual": "1 Kings" }, - { "abbr": "first king", "actual": "1 Kings" }, - { "abbr": "first kgs", "actual": "1 Kings" }, - { "abbr": "first kn", "actual": "1 Kings" }, - { "abbr": "first k", "actual": "1 Kings" }, - { "abbr": "first ki", "actual": "1 Kings" }, - { "abbr": "2 Kings", "actual": "2 Kings" }, - { "abbr": "2 king", "actual": "2 Kings" }, - { "abbr": "2 kgs", "actual": "2 Kings" }, - { "abbr": "2 kn", "actual": "2 Kings" }, - { "abbr": "2 k", "actual": "2 Kings" }, - { "abbr": "2 ki", "actual": "2 Kings" }, - { "abbr": "ii kings", "actual": "2 Kings" }, - { "abbr": "ii king", "actual": "2 Kings" }, - { "abbr": "ii kgs", "actual": "2 Kings" }, - { "abbr": "ii kn", "actual": "2 Kings" }, - { "abbr": "ii k", "actual": "2 Kings" }, - { "abbr": "ii ki", "actual": "2 Kings" }, - { "abbr": "2nd kings", "actual": "2 Kings" }, - { "abbr": "2nd king", "actual": "2 Kings" }, - { "abbr": "2nd kgs", "actual": "2 Kings" }, - { "abbr": "2nd kn", "actual": "2 Kings" }, - { "abbr": "2nd k", "actual": "2 Kings" }, - { "abbr": "2nd ki", "actual": "2 Kings" }, - { "abbr": "second kings", "actual": "2 Kings" }, - { "abbr": "second king", "actual": "2 Kings" }, - { "abbr": "second kgs", "actual": "2 Kings" }, - { "abbr": "second kn", "actual": "2 Kings" }, - { "abbr": "second k", "actual": "2 Kings" }, - { "abbr": "second ki", "actual": "2 Kings" }, - { "abbr": "sec kings", "actual": "2 Kings" }, - { "abbr": "sec king", "actual": "2 Kings" }, - { "abbr": "sec kgs", "actual": "2 Kings" }, - { "abbr": "sec kn", "actual": "2 Kings" }, - { "abbr": "sec k", "actual": "2 Kings" }, - { "abbr": "sec ki", "actual": "2 Kings" }, - { "abbr": "2 Chronicles", "actual": "2 Chronicles" }, - { "abbr": "2 chronicles", "actual": "2 Chronicles" }, - { "abbr": "2 chron", "actual": "2 Chronicles" }, - { "abbr": "2 ch", "actual": "2 Chronicles" }, - { "abbr": "2 chr", "actual": "2 Chronicles" }, - { "abbr": "ii Chronicles", "actual": "2 Chronicles" }, - { "abbr": "ii chronicles", "actual": "2 Chronicles" }, - { "abbr": "ii chron", "actual": "2 Chronicles" }, - { "abbr": "ii ch", "actual": "2 Chronicles" }, - { "abbr": "ii chr", "actual": "2 Chronicles" }, - { "abbr": "2nd Chronicles", "actual": "2 Chronicles" }, - { "abbr": "2nd chronicles", "actual": "2 Chronicles" }, - { "abbr": "2nd chron", "actual": "2 Chronicles" }, - { "abbr": "2nd ch", "actual": "2 Chronicles" }, - { "abbr": "2nd chr", "actual": "2 Chronicles" }, - { "abbr": "second Chronicles", "actual": "2 Chronicles" }, - { "abbr": "second chronicles", "actual": "2 Chronicles" }, - { "abbr": "second chron", "actual": "2 Chronicles" }, - { "abbr": "second ch", "actual": "2 Chronicles" }, - { "abbr": "second chr", "actual": "2 Chronicles" }, - { "abbr": "sec Chronicles", "actual": "2 Chronicles" }, - { "abbr": "sec chronicles", "actual": "2 Chronicles" }, - { "abbr": "sec chron", "actual": "2 Chronicles" }, - { "abbr": "sec ch", "actual": "2 Chronicles" }, - { "abbr": "sec chr", "actual": "2 Chronicles" }, - { "abbr": "1 Chronicles", "actual": "1 Chronicles" }, - { "abbr": "1 chronicles", "actual": "1 Chronicles" }, - { "abbr": "1 chron", "actual": "1 Chronicles" }, - { "abbr": "1 ch", "actual": "1 Chronicles" }, - { "abbr": "1 chr", "actual": "1 Chronicles" }, - { "abbr": "i Chronicles", "actual": "1 Chronicles" }, - { "abbr": "i chronicles", "actual": "1 Chronicles" }, - { "abbr": "i chron", "actual": "1 Chronicles" }, - { "abbr": "i ch", "actual": "1 Chronicles" }, - { "abbr": "i chr", "actual": "1 Chronicles" }, - { "abbr": "1st Chronicles", "actual": "1 Chronicles" }, - { "abbr": "1st chronicles", "actual": "1 Chronicles" }, - { "abbr": "1st chron", "actual": "1 Chronicles" }, - { "abbr": "1st ch", "actual": "1 Chronicles" }, - { "abbr": "1st chr", "actual": "1 Chronicles" }, - { "abbr": "first Chronicles", "actual": "1 Chronicles" }, - { "abbr": "first chronicles", "actual": "1 Chronicles" }, - { "abbr": "first chron", "actual": "1 Chronicles" }, - { "abbr": "first ch", "actual": "1 Chronicles" }, - { "abbr": "first chr", "actual": "1 Chronicles" }, - { "abbr": "ezra", "actual": "Ezra" }, - { "abbr": "ezr", "actual": "Ezra" }, - { "abbr": "nehemiah", "actual": "Nehemiah" }, - { "abbr": "neh", "actual": "Nehemiah" }, - { "abbr": "ne", "actual": "Nehemiah" }, - { "abbr": "nehamiah", "actual": "Nehemiah" }, - { "abbr": "esther", "actual": "Esther" }, - { "abbr": "est", "actual": "Esther" }, - { "abbr": "es", "actual": "Esther" }, - { "abbr": "esth", "actual": "Esther" }, - { "abbr": "job", "actual": "Job" }, - { "abbr": "jo", "actual": "Job" }, - { "abbr": "jb", "actual": "Job" }, - { "abbr": "psalms", "actual": "Psalm" }, - { "abbr": "ps", "actual": "Psalm" }, - { "abbr": "psa", "actual": "Psalm" }, - { "abbr": "psalm", "actual": "Psalm" }, - { "abbr": "psm", "actual": "Psalm" }, - { "abbr": "proverbs", "actual": "Proverbs" }, - { "abbr": "prov", "actual": "Proverbs" }, - { "abbr": "pr", "actual": "Proverbs" }, - { "abbr": "pro", "actual": "Proverbs" }, - { "abbr": "proverb", "actual": "Proverbs" }, - { "abbr": "prv", "actual": "Proverbs" }, - { "abbr": "prvbs", "actual": "Proverbs" }, - { "abbr": "ecclesiastes", "actual": "Ecclesiastes" }, - { "abbr": "eccl", "actual": "Ecclesiastes" }, - { "abbr": "ecc", "actual": "Ecclesiastes" }, - { "abbr": "eccles", "actual": "Ecclesiastes" }, - { "abbr": "ec", "actual": "Ecclesiastes" }, - { "abbr": "ecl", "actual": "Ecclesiastes" }, - { "abbr": "ecclesiaste", "actual": "Ecclesiastes" }, - { "abbr": "song of solomon", "actual": "Song of Solomon" }, - { "abbr": "song of songs", "actual": "Song of Solomon" }, - { "abbr": "sos", "actual": "Song of Solomon" }, - { "abbr": "ss", "actual": "Song of Solomon" }, - { "abbr": "son", "actual": "Song of Solomon" }, - { "abbr": "so", "actual": "Song of Solomon" }, - { "abbr": "song", "actual": "Song of Solomon" }, - { "abbr": "songs", "actual": "Song of Solomon" }, - { "abbr": "isaiah", "actual": "Isaiah" }, - { "abbr": "is", "actual": "Isaiah" }, - { "abbr": "isah", "actual": "Isaiah" }, - { "abbr": "isai", "actual": "Isaiah" }, - { "abbr": "ia", "actual": "Isaiah" }, - { "abbr": "jerimiah", "actual": "Jeremiah" }, - { "abbr": "jeremiah", "actual": "Jeremiah" }, - { "abbr": "jer", "actual": "Jeremiah" }, - { "abbr": "je", "actual": "Jeremiah" }, - { "abbr": "jere", "actual": "Jeremiah" }, - { "abbr": "lamentations", "actual": "Lamentations" }, - { "abbr": "lam", "actual": "Lamentations" }, - { "abbr": "la", "actual": "Lamentations" }, - { "abbr": "lamentation", "actual": "Lamentations" }, - ]; - - for (let bk of booknames) { - it('Get Data for: ' + bk.abbr, () => { - let svc: BibleService = getTestBed().get(BibleService); - let book = Reference.parseBook(bk.abbr); - for (let i = 1; i <= book.lastchapter; i++) + for (let j = 1; j < 67; j++) + { + let name = Reference.bookName(j); + let book = Reference.parseBook(name); + for (let i = 1; i <= book.lastchapter; i++) + { + it('Get Data for: ' + name + " " + i, () => { - let ref = new Reference(bk.abbr + " "+i).Section; + let svc: BibleService = getTestBed().get(BibleService); + let ref = new Reference(name + " " + i).Section; var r = svc.getResult(ref); expect(r.msg).toBe(':)'); - expect(r.ref).toBe(book.bookname + " "+i+":1 - *"); + expect(r.ref).toBe(book.bookname + " " + i + ":1 - *"); expect(r.status).toBe(0); expect(r.cs[0].vss.length).toBeGreaterThan(1); - } - }); + }); + + } + } }); diff --git a/DynamicBibleIonic/src/strongs-service.spec.ts b/DynamicBibleIonic/src/strongs-service.spec.ts new file mode 100644 index 00000000..69bf519b --- /dev/null +++ b/DynamicBibleIonic/src/strongs-service.spec.ts @@ -0,0 +1,57 @@ +import { getTestBed, TestBed } from '@angular/core/testing'; +import { BaseRequestOptions, HttpModule, Http, } from '@angular/http'; +import { MockBackend } from '@angular/http/testing'; +import { StrongsService } from './strongs-service'; + +describe('Strongs Service', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpModule], + providers: [ + StrongsService, + { + provide: Http, + useFactory: function (backend, defaultOptions) { + return new Http(backend, defaultOptions); + }, + deps: [MockBackend, BaseRequestOptions] + }, + MockBackend, + BaseRequestOptions + ] + }); + }); + + it('Should return an error status', () => { + let svc: StrongsService = getTestBed().get(StrongsService); + let r = svc.getResult(6000, "grk"); + + }); + it('Should get G2396', () => { + let svc: StrongsService = getTestBed().get(StrongsService); + let r = svc.getResult(2396, "grk"); + expect(r.msg).toBe(':)'); + expect(r.status).toBe(0); + }); + + for (let j = 1; j <= 5624; j++) { + it('Get G' + j, () => { + let svc: StrongsService = getTestBed().get(StrongsService); + let r = svc.getResult(j, "grk"); + + expect(r.msg).toBe(':)'); + expect(r.status).toBe(0); + }); + } + + for (let j = 1; j <= 8674; j++) { + it('Get H' + j, () => { + let svc: StrongsService = getTestBed().get(StrongsService); + let r = svc.getResult(j, "heb"); + + expect(r.msg).toBe(':)'); + expect(r.status).toBe(0); + }); + } + +}); diff --git a/DynamicBibleIonic/src/strongs-service.ts b/DynamicBibleIonic/src/strongs-service.ts index c32ad183..e92b4a4a 100644 --- a/DynamicBibleIonic/src/strongs-service.ts +++ b/DynamicBibleIonic/src/strongs-service.ts @@ -4,17 +4,14 @@ import { Injectable } from "@angular/core"; import { Http } from "@angular/http"; @Injectable() -export class StrongsService -{ +export class StrongsService { result: StrongsResult; count = 0; - constructor(private http: Http) - { + constructor(private http: Http) { } - getResult(sn: number, dict: string): StrongsResult - { + getResult(sn: number, dict: string): StrongsResult { const self = this; this.result = { prefix: "", @@ -28,19 +25,15 @@ export class StrongsService msg: ":)" }; let url = dict + Math.ceil(sn / 100) + ".json"; - if (dict === "grk") - { + if (dict === "grk") { self.result.prefix = "G"; - if (sn > 5624 || sn < 1) - { + if (sn > 5624 || sn < 1) { self.result.status = -1; self.result.msg = "Strongs Number G" + sn + " is out of range."; } - } else - { + } else { self.result.prefix = "H"; - if (sn > 8674 || sn < 1) - { + if (sn > 8674 || sn < 1) { self.result.status = -1; self.result.msg = "Strongs Number H" + sn + " is out of range."; } @@ -53,14 +46,12 @@ export class StrongsService $.ajax({ async: false, type: "GET", - url: `data/strongs/${url}`, + url: "data/strongs/" + url, dataType: "json", - success: function (d: StrongsDefinition[], t, x) - { + success: function (d: StrongsDefinition[], t, x) { self.result.strongs = d; }, - error: function (request, status, error) - { + error: function (request, status, error) { console.log(error); self.result.status = -1; self.result.msg = "Unable to retrieve Strongs Data for " + self.result.prefix + self.result.sn; @@ -76,21 +67,17 @@ export class StrongsService $.ajax({ async: false, type: "GET", - url: `data/strongscr/cr${url}`, + url: "data/strongscr/cr" + url, dataType: "json", - success: function (d: StrongsCrossReference[], t, x) - { - for (let cr of d) - { - if (cr.id.toUpperCase() == self.result.prefix + self.result.sn) - { + success: function (d: StrongsCrossReference[], t, x) { + for (let cr of d) { + if (cr.id.toUpperCase() == self.result.prefix + self.result.sn) { self.result.crossrefs = cr; break; } } }, - error: function (request, status, error) - { + error: function (request, status, error) { console.log(error); self.result.status = -1; self.result.msg = "Unable to retrieve Strongs Cross References for " + self.result.prefix + self.result.sn; @@ -100,9 +87,8 @@ export class StrongsService if (self.result.status === -1) return self.result; - if (dict === "grk") - { - url = `data/rmac/rs${Math.ceil(sn / 1000)}.json`; + if (dict === "grk") { + url = "data/rmac/rs" + (Math.ceil(sn / 1000)) + ".json"; let rmac_cross_references: RMACCrossReference[]; // rmac is a two get process. @@ -111,39 +97,36 @@ export class StrongsService type: "GET", url: url, dataType: "json", - success: function (d: RMACCrossReference[], t, x) - { + success: function (d: RMACCrossReference[], t, x) { rmac_cross_references = d; }, - error: function (request, status, error) - { + error: function (request, status, error) { console.log(error); } }); // deal with RMAC - this.result.rmaccode = $.grep(rmac_cross_references, (el, i) => { if (el.i == sn + "") { return true; } else { return false; } })[0].r; - if (this.result.rmaccode != undefined) - { + let tmp = $.grep(rmac_cross_references, (el, i) => { if (el.i == sn + "") { return true; } else { return false; } }); + if (tmp.length == 0) + return this.result; + + this.result.rmaccode = tmp[0].r; + if (this.result.rmaccode != undefined) { url = `data/rmac/r-${this.result.rmaccode.substring(0, 1)}.json`; $.ajax({ async: false, type: "GET", url: url, dataType: "json", - success: function (d: RMACDefinition[], t, x) - { - for (let rmac of d) - { - if (rmac.id.toLowerCase() == self.result.rmaccode) - { + success: function (d: RMACDefinition[], t, x) { + for (let rmac of d) { + if (rmac.id.toLowerCase() == self.result.rmaccode) { self.result.rmac = rmac; break; } } }, - error: function (request, status, error) - { + error: function (request, status, error) { console.log(error); } }); diff --git a/DynamicBibleIonic/src/word-service.ts b/DynamicBibleIonic/src/word-service.ts index ccf3746c..35d6bf99 100644 --- a/DynamicBibleIonic/src/word-service.ts +++ b/DynamicBibleIonic/src/word-service.ts @@ -34,7 +34,8 @@ export class WordService results.unshift(this.getSearchReferences("data/index/" + words[w] + "idx.json", q)); break; } - } else + } + else { if (q <= words[w] && q > words[w - 1]) { @@ -375,16 +376,15 @@ export class WordService { let r = refs[i].split(":"); // convert references to single integers. - // Book * 100000, Chapter * 1000, Verse remains same, add all together. + // Book * 100000000, Chapter * 10000, Verse remains same, add all together. let ref = r[0] * 100000000; ref = ref + (r[1] * 10000); ref = ref + r[2] * 1; results[j][i] = ref; } - } else - { - return null; } + else + return null; } // get the first result @@ -392,9 +392,7 @@ export class WordService // for each additional result, get the shared set for (let i = 1; i < results.length; i++) - { result = this.returnSharedSet(results[i], result); - } // convert the references back into book, chapter and verse. for (let i = 0; i < result.length; i++) @@ -424,29 +422,23 @@ export class WordService while (i < t) { if (x[i] == y[i]) - { i++; - } + if (x[i] < y[i]) - { x.splice(i, 1); - } + if (x[i] > y[i]) - { y.splice(i, 1); - } + t = (x.length < y.length) ? x.length : y.length; // we have to make sure to remove any extra values // at the end of an array when we reach the end of // the other. if (t == i && t < x.length) - { x.splice(i, x.length - i); - } + if (t == i && t < y.length) - { y.splice(i, x.length - i); - } } // we could return y, because at this time, both arrays // are identical. diff --git a/DynamicBibleIonic/www/data/strongs/grk57.json b/DynamicBibleIonic/www/data/strongs/grk57.json new file mode 100644 index 00000000..a5dbff4b --- /dev/null +++ b/DynamicBibleIonic/www/data/strongs/grk57.json @@ -0,0 +1 @@ +[{"n":5601,"i":"G5601","p":"o-bade'","lemma":"Ὠβήδ","tr":"Ōbēd","de":"Of Hebrew origin [H5744];
Obed an Israelite: - Obed."},{"n":5602,"i":"G5602","p":"ho'-deh","lemma":"ὧδε","tr":"hōde","de":"From an adverb form of G3592; in this same spot that is here or hither: - here hither (in) this place there."},{"n":5603,"i":"G5603","p":"o-day'","lemma":"ᾠδή","tr":"ōdē","de":"From G103; a chant or ode (the general term for any words sung; while G5215 denotes especially a religious metrical composition and G5568 still more specifically a Hebrewcantillation: - song."},{"n":5604,"i":"G5604","p":"o-deen'","lemma":"ὠδίν","tr":"ōdin","de":"Akin to G3601; a pang or throe especially of childbirth: - pain sorrow travail."},{"n":5605,"i":"G5605","p":"o-dee'-no","lemma":"ὠδίνω","tr":"ōdinō","de":"From G5604; to experience the pains of parturition (literally or figuratively): - travail in (birth)."},{"n":5606,"i":"G5606","p":"o'-mos","lemma":"ὦμος","tr":"ōmos","de":"Perhaps from the alternate of G5342; the shoulder (as that on which burdens are borne): - shoulder."},{"n":5607,"i":"G5607","p":"oan oo'-sah on","lemma":"ὤν","tr":"ōn ousa on","de":"The feminine the neuter and the present participle of G1510; being: - be come have."},{"n":5608,"i":"G5608","p":"o-neh'-om-ahee","lemma":"ὠνέομαι","tr":"ōneomai","de":"Middle voice from an apparently primary word ὦνος ōnos (a sum or price); to purchase (synonymous with the earlier G4092): - buy."},{"n":5609,"i":"G5609","p":"o-on'","lemma":"ὠόν","tr":"ōon","de":"Apparently a primary word; an egg: - egg."},{"n":5610,"i":"G5610","p":"ho'-rah","lemma":"ὥρα","tr":"hōra","de":"Apparently a primary word; an hour (literally or figuratively): - day hour instant season X short [even-] tide (high) time."},{"n":5611,"i":"G5611","p":"ho-rah'-yos","lemma":"ὡραῖος","tr":"hōraios","de":"From G5610; belonging to the right hour or season (timely) that is (by implication) flourishing (beauteous [figuratively]): - beautiful."},{"n":5612,"i":"G5612","p":"o-roo'-om-ahee","lemma":"ὠρύομαι","tr":"ōruomai","de":"Middle voice of an apparently primary verb; to roar: - roar."},{"n":5613,"i":"G5613","p":"hoce","lemma":"ὡς","tr":"hōs","de":"Probably adverb of compound from G3739; which how that is in that manner (very variously used as shown): - about after (that) (according) as (it had been it were) as soon (as) even as (like) for how (greatly) like (as unto) since so (that) that to wit unto when ([-soever]) while X with all speed."},{"n":5614,"i":"G5614","p":"ho-san-nah'","lemma":"ὡσαννά","tr":"hōsanna","de":"Of Hebrew origin [H3467] and [H4994];
oh save!;
hosanna (that is hoshia-na) an exclamation of adoration: - hosanna."},{"n":5615,"i":"G5615","p":"ho-sow'-toce","lemma":"ὡσαύτως","tr":"hōsautōs","de":"From G5613 and an adverb from G846; as thus that is in the sameway: - even so likewise after the same (in like) manner."},{"n":5616,"i":"G5616","p":"ho-si'","lemma":"ὡσεί","tr":"hōsei","de":"From G5613 and G1487; asif: - about as (it had been it were) like (as)."},{"n":5617,"i":"G5617","p":"ho-say-eh'","lemma":"Ὡσηέ","tr":"Hōsēe","de":"Of Hebrew origin [H1954];
Hosee (that is Hoshea) an Israelite: - Osee."},{"n":5618,"i":"G5618","p":"hoce'-per","lemma":"ὥσπερ","tr":"hōsper","de":"From G5613 and G4007; just as that is exactlylike: - (even like) as."},{"n":5619,"i":"G5619","p":"hoce-per-i'","lemma":"ὡσπερεί","tr":"hōsperei","de":"From G5618 and G1487; just as if that is as itwere: - as."},{"n":5620,"i":"G5620","p":"hoce'-teh","lemma":"ὥστε","tr":"hōste","de":"From G5613 and G5037; so too that is thus therefore (in various relations of consecution as shown): - (insomuch) as so that (then) (insomuch) that therefore to wherefore."},{"n":5621,"i":"G5621","p":"o-tee'-on","lemma":"ὠτίον","tr":"ōtion","de":"Diminutive of G3775; an earlet that is one of the ears or perhaps the lobe of the ear: - ear."},{"n":5622,"i":"G5622","p":"o-fel'-i-ah","lemma":"ὠφέλεια","tr":"ōpheleia","de":"From a derivative of the base of G5624; usefulness that is benefit: - advantage profit."},{"n":5623,"i":"G5623","p":"o-fel-eh'-o","lemma":"ὠφελέω","tr":"ōpheleō","de":"From the same as G5622; to be useful that is to benefit: - advantage better prevail profit."},{"n":5624,"i":"G5624","p":"o-fel'-ee-mos","lemma":"ὠφέλιμος","tr":"ōphelimos","de":"From a form of G3786; helpful or serviceable that is advantageous: - profit (-able)."}] \ No newline at end of file diff --git a/DynamicBibleIonic/www/data/strongs/heb87.json b/DynamicBibleIonic/www/data/strongs/heb87.json new file mode 100644 index 00000000..61caf242 --- /dev/null +++ b/DynamicBibleIonic/www/data/strongs/heb87.json @@ -0,0 +1 @@ +[{"n":8601,"i":"H8601","p":"too-feen'","lemma":"תֻּפִין","tr":"tûphîyn","de":"From H644; {cookery} that {is} (concretely) a cake: - baked piece."},{"n":8602,"i":"H8602","p":"taw-fale'","lemma":"תָּפֵל","tr":"tâphêl","de":"From an unused root meaning to smear;
plaster (as gummy) or slime; (figuratively) frivolity: - foolish {things} {unsavoury} untempered."},{"n":8603,"i":"H8603","p":"to'-fel","lemma":"תֹּפֶל","tr":"tôphel","de":"From the same as H8602; quagmire;
{Tophel} a place near the Desert: - Tophel."},{"n":8604,"i":"H8604","p":"tif-law'","lemma":"תִּפְלָה","tr":"tiphlâh","de":"From the same as H8602; frivolity: - {folly} foolishly."},{"n":8605,"i":"H8605","p":"tef-il-law'","lemma":"תְּפִלָּה","tr":"tephillâh","de":"From H6419; {intercession}supplication; by implication a hymn: - prayer."},{"n":8606,"i":"H8606","p":"tif-leh'-tseth","lemma":"תִּפְלֶצֶת","tr":"tiphletseth","de":"From H6426; fearfulness: - terrible."},{"n":8607,"i":"H8607","p":"tif-sakh'","lemma":"תִּפְסַח","tr":"tiphsach","de":"From H6452; ford;
{Tiphsach} a place in Mesopotamia: - Tipsah."},{"n":8608,"i":"H8608","p":"taw-faf'","lemma":"תָּפַף","tr":"tâphaph","de":"A primitive root; to {drum} that {is} play (as) on the tambourine: - {taber} play with timbrels."},{"n":8609,"i":"H8609","p":"taw-far'","lemma":"תָּפַר","tr":"tâphar","de":"A primitive root; to sew: - (women that) sew (together)."},{"n":8610,"i":"H8610","p":"taw-fas'","lemma":"תָּפַשׂ","tr":"tâphaώ","de":"A primitive root; to {manipulate} that {is} seize; chiefly to {capture}wield; specifically to overlay; figuratively to useunwarrantably: - {catch} {handle} ({lay} take) hold ({on} {over}) {stop} X {surely} {surprise} take."},{"n":8611,"i":"H8611","p":"to'-feth","lemma":"תֹּפֶת","tr":"tôpheth","de":"From the base of H8608; a {smiting} that {is} (figuratively) contempt: - tabret."},{"n":8612,"i":"H8612","p":"to'-feth","lemma":"תֹּפֶת","tr":"tôpheth","de":"The same as H8611; {Topheth} a place near Jerusalem: - {Tophet} Topheth."},{"n":8613,"i":"H8613","p":"tof-teh'","lemma":"תׇּפְתֶּה","tr":"tophteh","de":"Probably a form of H8612; {Tophteh} a place of cremation: - Tophet."},{"n":8614,"i":"H8614","p":"tif-tah'ee","lemma":"תִּפְתַּי","tr":"tiphtay","de":"{(Chaldee}) perhaps from H8199; {judicial} that {is} a lawyer: - sheriff."},{"n":8615,"i":"H8615","p":"tik-vaw'","lemma":"תִּקְוָה","tr":"tiqvâh","de":"From H6960; literally a cord (as an attachment (compare H6961)); figuratively expectancy: - expectation ({[-ted]}) {hope} {live} thing that I long for."},{"n":8616,"i":"H8616","p":"tik-vaw'","lemma":"תִּקְוָה","tr":"tiqvâh","de":"The same as H8615; {Tikvah} the name of two Israelites: - Tikvah."},{"n":8617,"i":"H8617","p":"tek-oo-maw'","lemma":"תְּקוּמָה","tr":"teqûmâh","de":"From H6965; resistfulness: - power to stand."},{"n":8618,"i":"H8618","p":"tek-o-mame'","lemma":"תְּקוֹמֵם","tr":"teqômêm","de":"From H6965; an opponent: - rise up against."},{"n":8619,"i":"H8619","p":"taw-ko'-ah","lemma":"תָּקוֹעַ","tr":"tâqôa‛","de":"From H8628 (in the muscal sense); a trumpet: - trumpet."},{"n":8620,"i":"H8620","p":"tek-o'-ah","lemma":"תְּקוֹעַ","tr":"teqôa‛","de":"A form of H8619; {Tekoa} a place in Palestine: - {Tekoa} Tekoah."},{"n":8621,"i":"H8621","p":"{tek-o-ee'} tek-o-ee'","lemma":"תְּקוֹעִי","tr":"teqô‛îy teqô‛îy","de":"Patronymic from H8620; a Tekoite or inhabitant of Tekoah: - Tekoite."},{"n":8622,"i":"H8622","p":"{tek-oo-faw'} tek-oo-faw'","lemma":"תְּקוּפָה","tr":"teqûphâh teqûphâh","de":"From H5362; a {revolution} that {is} (of the sun) {course} (of time) lapse: - {circuit} come {about} end."},{"n":8623,"i":"H8623","p":"tak-keef'","lemma":"תַּקִּיף","tr":"taqqîyph","de":"From H8630; powerful: - mightier."},{"n":8624,"i":"H8624","p":"tak-keef'","lemma":"תַּקִּיף","tr":"taqqîyph","de":"{(Chaldee}) corresponding to H8623: - {mighty} strong."},{"n":8625,"i":"H8625","p":"tek-al'","lemma":"תְּקַל","tr":"teqal","de":"(Chaldee); corresponding to H8254; to balance: - {Tekel} be weighed."},{"n":8626,"i":"H8626","p":"taw-kan'","lemma":"תָּקַן","tr":"tâqan","de":"A primitive root; to {equalize} that {is} straighten (intransitively or transitively); figuratively to compose: - set in {order} make straight."},{"n":8627,"i":"H8627","p":"tek-an'","lemma":"תְּקַן","tr":"teqan","de":"{(Chaldee}) corresponding to H8626; to straighten {up} that {is} confirm: - establish."},{"n":8628,"i":"H8628","p":"taw-kah'","lemma":"תָּקַע","tr":"tâqa‛","de":"A primitive root; to {clatter} that {is} slap (the hands {together}) clang (an instrument); by analogy to drive (a nail or tent {pin} a {dart} etc.); by implication to become bondsman (by handclasping): - blow ([a {trumpet]}) {cast} {clap} {fasten} pitch {[tent]} {smite} {sound} {strike} X {suretiship} thrust."},{"n":8629,"i":"H8629","p":"tay-kah'","lemma":"תֵּקַע","tr":"têqa‛","de":"From H8628; a blast of a trumpet: - sound."},{"n":8630,"i":"H8630","p":"taw-kaf'","lemma":"תָּקַף","tr":"tâqaph","de":"A primitive root; to overpower: - prevail (against.)."},{"n":8631,"i":"H8631","p":"tek-afe'","lemma":"תְּקֵף","tr":"teqêph","de":"{(Chaldee}) corresponding to H8630; to become (causatively make) mighty or (figuratively) obstinate: - make {firm} {harden} be (-come) strong."},{"n":8632,"i":"H8632","p":"tek-ofe'","lemma":"תְּקֹף","tr":"teqôph","de":"{(Chaldee}) corresponding to H8633; power: - {might} strength."},{"n":8633,"i":"H8633","p":"to'-kef","lemma":"תֹּקֶף","tr":"tôqeph","de":"From H8630; might or (figuratively) positiveness: - {authority} {power} strength."},{"n":8634,"i":"H8634","p":"tar-al-aw'","lemma":"תַּרְאֲלָה","tr":"tar'ălâh","de":"Probably for H8653; a reeling;
{Taralah} a place in Palestine: - Taralah."},{"n":8635,"i":"H8635","p":"tar-booth'","lemma":"תַּרְבּוּת","tr":"tarbûth","de":"From H7235; {multiplication} that {is} progeny: - increase."},{"n":8636,"i":"H8636","p":"tar-beeth'","lemma":"תַּרְבִּית","tr":"tarbîyth","de":"From H7235; {multiplication} that {is} percentage or bonus in addition to principal: - {increase} unjust gain."},{"n":8637,"i":"H8637","p":"teer-gal'","lemma":"תִּרְגַּל","tr":"tirgal","de":"A denominative from H7270; to cause towalk: - teach to go."},{"n":8638,"i":"H8638","p":"teer-gam'","lemma":"תִּרְגַּם","tr":"tirgam","de":"A denominative from H7275 in the sense of throwing over; to {transfer} that {is} translate: - interpret."},{"n":8639,"i":"H8639","p":"tar-day-maw'","lemma":"תַּרְדֵּמָה","tr":"tardêmâh","de":"From H7290; a lethargy or (by implication) trance: - deep sleep."},{"n":8640,"i":"H8640","p":"teer-haw'-kaw","lemma":"תִּרְהָקָה","tr":"tirhâqâh","de":"Of foreign derivation;
{Tirhakah} a king of Kush: - Tirhakah."},{"n":8641,"i":"H8641","p":"{ter-oo-maw'} ter-oo-maw'","lemma":"תְּרוּמָה","tr":"terûmâh terûmâh","de":"(The second form used in ); from H7311; a present (as offered {up}) especially in sacrifice or as tribute: - {gift} heave offering ({[shoulder]}) {oblation} offered (-ing)."},{"n":8642,"i":"H8642","p":"ter-oo-mee-yaw'","lemma":"תְּרוּמִיָּה","tr":"terûmîyâh","de":"Formed as H8641; a sacrificial offering: - oblation."},{"n":8643,"i":"H8643","p":"ter-oo-aw'","lemma":"תְּרוּעָה","tr":"terû‛âh","de":"From H7321; {clamor} that {is} acclamation of joy or a battle cry; especially clangor of {trumpets} as an alarum: - {alarm} blow (-ing) ({of} the) ({trumpets}) {joy} {jubile} loud {noise} {rejoicing} shout ({-ing}) ({high} joyful) sound (-ing)."},{"n":8644,"i":"H8644","p":"ter-oo-faw'","lemma":"תְּרוּפָה","tr":"terûphâh","de":"From H7322 in the sense of its congener H7495; a remedy: - medicine."},{"n":8645,"i":"H8645","p":"teer-zaw'","lemma":"תִּרְזָה","tr":"tirzâh","de":"Probably from H7329; a species of tree (apparently from its {slenderness}) perhaps the cypress: - cypress."},{"n":8646,"i":"H8646","p":"teh'-rakh","lemma":"תֶּרַח","tr":"terach","de":"Of uncertain derivation;
{Terach} the father of Abraham; also a place in the Desert: - {Tarah} Terah."},{"n":8647,"i":"H8647","p":"teer-khan-aw'","lemma":"תִּרְחֲנָה","tr":"tirchănâh","de":"Of uncertain derivation;
{Tirchanah} an Israelite: - Tirhanah."},{"n":8648,"i":"H8648","p":"{ter-ane'} tar-tane'","lemma":"תְּרֵין","tr":"terêyn tartêyn","de":"{(Chaldee}) the secend form is feminine; corresponding to H8147; two: - {second} + {twelve} two."},{"n":8649,"i":"H8649","p":"{tor-maw'} {tar-mooth'} tar-meeth'","lemma":"תׇּרְמָה","tr":"tormâh tarmûth tarmîyth","de":"From H7411; fraud: - deceit ({-ful}) privily."},{"n":8650,"i":"H8650","p":"to'-ren","lemma":"תֹּרֶן","tr":"tôren","de":"Probably for H766; a pole (as a mast or flag staff): - {beacon} mast."},{"n":8651,"i":"H8651","p":"ter-ah'","lemma":"תְּרַע","tr":"tera‛","de":"{(Chaldee}) corresponding to H8179; a door; by implication a palace: - gate mouth."},{"n":8652,"i":"H8652","p":"taw-raw'","lemma":"תָּרָע","tr":"târâ‛","de":"{(Chaldee}) from H8651; a doorkeeper: - porter."},{"n":8653,"i":"H8653","p":"tar-ay-law'","lemma":"תַּרְעֵלָה","tr":"tar‛êlâh","de":"From H7477; reeling: - {astonishment} trembling."},{"n":8654,"i":"H8654","p":"teer-aw-thee'","lemma":"תִּרְעָתִי","tr":"tir‛âthîy","de":"Patrial from an unused name meaning gate; a Tirathite or inhabitant of an unknown Tirah: - Tirathite."},{"n":8655,"i":"H8655","p":"ter-aw-feme'","lemma":"תְּרָפִים","tr":"terâphîym","de":"Plural perhaps from H7495; a healer;
Teraphim (singular or plural) a family idol: - idols ({-atry}) {images} teraphim."},{"n":8656,"i":"H8656","p":"teer-tsaw'","lemma":"תִּרְצָה","tr":"tirtsâh","de":"From H7521; delightsomeness;
{Tirtsah} a place in Palestine; also an Israelitess: - also an Israelitess: - Tirzah."},{"n":8657,"i":"H8657","p":"teh'-resh","lemma":"תֶּרֶשׁ","tr":"teresh","de":"Of foreign derivation;
{Teresh} a eunuch of Xerxes: - Teresh."},{"n":8658,"i":"H8658","p":"tar-sheesh'","lemma":"תַּרְשִׁישׁ","tr":"tarshîysh","de":"Probably of foreign derivation (compare H8659); a {gem} perhaps the topaz: - beryl."},{"n":8659,"i":"H8659","p":"tar-sheesh'","lemma":"תַּרְשִׁישׁ","tr":"tarshîysh","de":"Probably the same as H8658 (as the region of the {stone} or the reverse);
{Tarshish} a place on the {Mediterranean} hence the epithet of a merchant vessel (as if for or from that port); also the name of a Persian and of an Israelite: - {Tarshish} Tharshish."},{"n":8660,"i":"H8660","p":"teer-shaw-thaw'","lemma":"תִּרְשָׁתָא","tr":"tirshâthâ'","de":"Of foreign derivation; the title of a Persian deputy or governor: - Tirshatha."},{"n":8661,"i":"H8661","p":"tar-tawn'","lemma":"תַּרְתָּן","tr":"tartân","de":"Of foreign derivation;
{Tartan} an Assyrian: - Tartan."},{"n":8662,"i":"H8662","p":"tar-tawk'","lemma":"תַּרְתָּק","tr":"tartâq","de":"Of foreign derivation;
{Tartak} a deity of the Avvites: - Tartak."},{"n":8663,"i":"H8663","p":"tesh-oo-aw'","lemma":"תְּשֻׁאָה","tr":"teshû'âh","de":"From H7722; a crashing or loud clamor: - {crying} {noise} {shouting} stir."},{"n":8664,"i":"H8664","p":"tish-bee'","lemma":"תִּשְׁבִּי","tr":"tishbîy","de":"Patrial from an unused name meaning recourse; a Tishbite or inhabitant of Tishbeh (in Gilead): - Tishbite."},{"n":8665,"i":"H8665","p":"tash-bates'","lemma":"תַּשְׁבֵּץ","tr":"tashbêts","de":"From H7660; checkered stuff (as reticulated): - broidered."},{"n":8666,"i":"H8666","p":"{tesh-oo-baw'} tesh-oo-baw'","lemma":"תְּשׁוּבָה","tr":"teshûbâh teshûbâh","de":"From H7725; a recurrence (of time or place); a reply (as returned): - {answer} be {expired} return."},{"n":8667,"i":"H8667","p":"tes-oo-meth'","lemma":"תְּשׂוּמֶת","tr":"teώûmeth","de":"From H7760; a {deposit} that {is} pledging: - + fellowship."},{"n":8668,"i":"H8668","p":"{tesh-oo-aw'} tesh-oo-aw'","lemma":"תְּשׁוּעָה","tr":"teshû‛âh teshû‛âh","de":"From H7768 in the sense of H3467; rescue (literally or {figuratively} {personal} national or spiritual): - {deliverance} {help} {safety} {salvation} victory."},{"n":8669,"i":"H8669","p":"tesh-oo-kaw'","lemma":"תְּשׁוּקָה","tr":"teshûqâh","de":"From H7783 in the original sense of stretching out after; a longing: - desire."},{"n":8670,"i":"H8670","p":"tesh-oo-raw'","lemma":"תְּשׁוּרָה","tr":"teshûrâh","de":"From H7788 in the sense of arrival; a gift: - present."},{"n":8671,"i":"H8671","p":"tesh-ee-ee'","lemma":"תְּשִׁיעִי","tr":"teshîy‛îy","de":"Ordinal from H8672; ninth: - ninth."},{"n":8672,"i":"H8672","p":"{tay'-shah} tish-aw'","lemma":"תֵּשַׁע","tr":"têsha‛ tish‛âh","de":"The second form is the masculine of the first; perhaps from H8159 through the idea of a turn to the next or full number ten;
nine or (ordinal) ninth: - nine (+ {-teen} + {-teenth} -th)."},{"n":8673,"i":"H8673","p":"tish-eem'","lemma":"תִּשְׁעִים","tr":"tish‛îym","de":"Multiple from H8672; ninety: - ninety."},{"n":8674,"i":"H8674","p":"tat-ten-ah'ee","lemma":"תַּתְּנַי","tr":"tattenay","de":"Of foreign derivation;
{Tattenai} a Persian: - Tatnai."}] \ No newline at end of file diff --git a/DynamicBibleUtility/.vs/config/applicationhost.config b/DynamicBibleUtility/.vs/config/applicationhost.config index d22bdd15..24088756 100644 --- a/DynamicBibleUtility/.vs/config/applicationhost.config +++ b/DynamicBibleUtility/.vs/config/applicationhost.config @@ -163,7 +163,7 @@ - + diff --git a/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs b/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs index f13af60f..0a24ef85 100644 --- a/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs +++ b/DynamicBibleUtility/DynamicBibleUtility/frmMain.cs @@ -47,7 +47,7 @@ namespace DynamicBibleUtility if (!_words.Contains(s)) { _words.Add(s); - var i = new IndexItem {word = s}; + var i = new IndexItem { word = s }; i.refs.Add(bk + ":" + ch + ":" + vs); _idx.Add(i); } @@ -262,17 +262,17 @@ namespace DynamicBibleUtility var el = (XElement)n; if (el.Name != "BIBLEBOOK") continue; - var bk = new Book {bk = Convert.ToInt32(el.FirstAttribute.Value)}; + var bk = new Book { bk = Convert.ToInt32(el.FirstAttribute.Value) }; foreach (XElement chn in el.Nodes()) { - var ch = new Chapter {ch = Convert.ToInt32(chn.FirstAttribute.Value)}; + var ch = new Chapter { ch = Convert.ToInt32(chn.FirstAttribute.Value) }; foreach (XElement vs in chn.Nodes()) { - var v = new Verse {v = Convert.ToInt32(vs.FirstAttribute.Value)}; + var v = new Verse { v = Convert.ToInt32(vs.FirstAttribute.Value) }; foreach (XNode o in vs.Nodes()) { v.w.AddRange(ProcessText(o)); - if (v.w.Count > 1 && + if (v.w.Count > 1 && ( v.w.Last().t.StartsWith("?") || v.w.Last().t.StartsWith(";") @@ -330,7 +330,7 @@ namespace DynamicBibleUtility else if (o.GetType() == typeof(XText)) { var t = ((XText)o).Value.Trim(); - + Ts.Add(new Text(t)); } else @@ -494,26 +494,52 @@ namespace DynamicBibleUtility foreach (var f in ofd.FileNames) { var doc = VAE.Common.Serialization.JSON.Deserialize(System.IO.File.ReadAllText(f), typeof(SDict)) as SDict; + var dict = doc.Entries.ToDictionary(k => k.Key, v => v.Value); - foreach (var pair in doc.Entries) + foreach (var pair in master_dict) { - pair.Value.i = pair.Key; pair.Value.n = Convert.ToInt32(pair.Key.Substring(1)); - if (master_dict.ContainsKey(pair.Key)) + if (dict.ContainsKey(pair.Key)) { - pair.Value.de = master_dict[pair.Key].de; - pair.Value.tr = master_dict[pair.Key].tr; - pair.Value.p = master_dict[pair.Key].p; + pair.Value.lemma = dict[pair.Key].lemma; } } + } - var lst = doc.Entries.Select(o => o.Value).OrderBy(o => o.n); + var lst_heb = master_dict.Values.Where(o => o.i.StartsWith("H")).OrderBy(o => o.n); + var lst_grk = master_dict.Values.Where(o => o.i.StartsWith("G")).OrderBy(o => o.n); + int i = 1; + foreach(var s in lst_grk) + { + if (s.n != i) + { + UpdateStatus(s.i + ":" + i+"\r\n"); + i = s.n; + } + i++; + } + i = 1; + foreach (var s in lst_heb) + { + if (s.n != i) + { + UpdateStatus(s.i + ":" + i + "\r\n"); + i = s.n; + } + i++; + } + + + var lsts = new List> { lst_grk, lst_heb }; + foreach (var lst in lsts) + { var last = 0; var temp = new List(); + var c = 0; foreach (var e in lst) { - var c = e.n; + c = e.n; temp.Add(e); if ((c / 100) > last) { @@ -524,6 +550,13 @@ namespace DynamicBibleUtility UpdateStatus("Set: " + last + "\r\n"); } } + + // handle the last set. + last = (temp.Last().n / 100)+1; + System.IO.File.WriteAllText((temp.First().i.Contains("H") ? "heb" : "grk") + last + ".json", VAE.Common.Serialization.JSON.Serialize(temp)); + temp = new List(); + + UpdateStatus("Set: " + last + "\r\n"); } } } @@ -560,7 +593,7 @@ namespace DynamicBibleUtility rmacs.Add(r); r.id = el.FirstAttribute.Value; r.d = new List(); - foreach(XElement d in el.Nodes()) + foreach (XElement d in el.Nodes()) { r.d.Add(d.Value); } @@ -569,9 +602,8 @@ namespace DynamicBibleUtility } var name = f.Substring(f.LastIndexOf("\\") + 1); name = name.Substring(0, name.IndexOf(".")); - System.IO.File.WriteAllText(name+ ".json", VAE.Common.Serialization.JSON.Serialize(rmacs)); + System.IO.File.WriteAllText(name + ".json", VAE.Common.Serialization.JSON.Serialize(rmacs)); UpdateStatus("Set: " + f + "\r\n"); - } } } @@ -615,7 +647,6 @@ namespace DynamicBibleUtility name = name.Substring(0, name.IndexOf(".")); System.IO.File.WriteAllText(name + ".json", VAE.Common.Serialization.JSON.Serialize(rmacs)); UpdateStatus("Set: " + f + "\r\n"); - } } }