diff options
-rw-r--r-- | libbible.cc | 7 | ||||
-rw-r--r-- | testLibbible.cc | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/libbible.cc b/libbible.cc index 1401208..901ff4e 100644 --- a/libbible.cc +++ b/libbible.cc @@ -159,8 +159,11 @@ vector<libbible::text> libbible::getText(libbible::passage pass) { bool endOfParagraph = false; - for(; key->getChapter() < pass.chapterEnd || - (key->getChapter() == pass.chapterEnd && key->getVerse() <= pass.verseEnd); + string book = string(key->getBookName()); + + for(; string(key->getBookName()) == book && + (key->getChapter() < pass.chapterEnd + || (key->getChapter() == pass.chapterEnd && key->getVerse() <= pass.verseEnd)); (*key)++) { string text = string(target->renderText()); diff --git a/testLibbible.cc b/testLibbible.cc index 20ff7d9..d3a265a 100644 --- a/testLibbible.cc +++ b/testLibbible.cc @@ -186,6 +186,9 @@ void TestLibbible::testGetText(void) { pair<int, int>(15, 4), pair<int, int>(15, 5)}); CPPUNIT_ASSERT(chapVerses == shouldContain); + + text = libbible::getText(libbible::getPassage("KJV", "John 21")); + CPPUNIT_ASSERT(text.back().verse == 25); } void TestLibbible::testSettings(void) { |