[sword-svn] r2508 - in trunk: include src/keys tests tests/testsuite

scribe at crosswire.org scribe at crosswire.org
Tue Mar 23 02:19:15 MST 2010


Author: scribe
Date: 2010-03-23 02:19:15 -0700 (Tue, 23 Mar 2010)
New Revision: 2508

Modified:
   trunk/include/versekey.h
   trunk/src/keys/versekey.cpp
   trunk/tests/testsuite/versekeytest.good
   trunk/tests/testsuite/verseparsing.good
   trunk/tests/testsuite/verseparsing.sh
   trunk/tests/versekeytest.cpp
Log:
Fixed a regression of suffix functionality and added tests to prevent future loss
Added more Book/Chapter math tests-- which don't succeed yet.


Modified: trunk/include/versekey.h
===================================================================
--- trunk/include/versekey.h	2010-03-20 13:43:42 UTC (rev 2507)
+++ trunk/include/versekey.h	2010-03-23 09:19:15 UTC (rev 2508)
@@ -93,7 +93,7 @@
 	mutable long lowerBound, upperBound;	// if autonorms is on
 	mutable VerseKey *tmpClone;
 
-	typedef struct { int test; int book; int chap; int verse; } VerseComponents;
+	typedef struct { int test; int book; int chap; int verse; char suffix; } VerseComponents;
 
 	mutable VerseComponents lowerBoundComponents, upperBoundComponents;	// if autonorms is off, we can't optimize with index
 

Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp	2010-03-20 13:43:42 UTC (rev 2507)
+++ trunk/src/keys/versekey.cpp	2010-03-23 09:19:15 UTC (rev 2508)
@@ -966,10 +966,11 @@
 	initBounds();
 
 	lowerBound = lb.Index();
-	lowerBoundComponents.test  = lb.getTestament();
-	lowerBoundComponents.book  = lb.getBook();
-	lowerBoundComponents.chap  = lb.getChapter();
-	lowerBoundComponents.verse = lb.getVerse();
+	lowerBoundComponents.test   = lb.getTestament();
+	lowerBoundComponents.book   = lb.getBook();
+	lowerBoundComponents.chap   = lb.getChapter();
+	lowerBoundComponents.verse  = lb.getVerse();
+	lowerBoundComponents.suffix = lb.getSuffix();
 
 	// both this following check and UpperBound check force upperBound to
 	// change allowing LowerBound then UpperBound logic to always flow
@@ -990,10 +991,11 @@
 	initBounds();
 
 	upperBound = ub.Index();
-	upperBoundComponents.test  = ub.getTestament();
-	upperBoundComponents.book  = ub.getBook();
-	upperBoundComponents.chap  = ub.getChapter();
-	upperBoundComponents.verse = ub.getVerse();
+	upperBoundComponents.test   = ub.getTestament();
+	upperBoundComponents.book   = ub.getBook();
+	upperBoundComponents.chap   = ub.getChapter();
+	upperBoundComponents.verse  = ub.getVerse();
+	upperBoundComponents.suffix = ub.getSuffix();
 
 	// see LowerBound comment, above
 	if (upperBound < lowerBound) upperBound = lowerBound;
@@ -1015,6 +1017,7 @@
 		tmpClone->book      = lowerBoundComponents.book;
 		tmpClone->chapter   = lowerBoundComponents.chap;
 		tmpClone->setVerse   (lowerBoundComponents.verse);
+		tmpClone->setSuffix  (lowerBoundComponents.suffix);
 	}
 	else tmpClone->Index(lowerBound);
 
@@ -1034,6 +1037,7 @@
 		tmpClone->book      = upperBoundComponents.book;
 		tmpClone->chapter   = upperBoundComponents.chap;
 		tmpClone->setVerse   (upperBoundComponents.verse);
+		tmpClone->setSuffix  (upperBoundComponents.suffix);
 	}
 	else tmpClone->Index(upperBound);
 
@@ -1064,16 +1068,18 @@
 		tmpClone->Chapter(tmpClone->getChapterMax());
 		tmpClone->Verse(tmpClone->getVerseMax());
 		upperBound = tmpClone->Index();
-		upperBoundComponents.test  = tmpClone->getTestament();
-		upperBoundComponents.book  = tmpClone->getBook();
-		upperBoundComponents.chap  = tmpClone->getChapter();
-		upperBoundComponents.verse = tmpClone->getVerse();
+		upperBoundComponents.test   = tmpClone->getTestament();
+		upperBoundComponents.book   = tmpClone->getBook();
+		upperBoundComponents.chap   = tmpClone->getChapter();
+		upperBoundComponents.verse  = tmpClone->getVerse();
+		upperBoundComponents.suffix = tmpClone->getSuffix();
 
 		lowerBound = 0;
-		lowerBoundComponents.test  = 0;
-		lowerBoundComponents.book  = 0;
-		lowerBoundComponents.chap  = 0;
-		lowerBoundComponents.verse = 0;
+		lowerBoundComponents.test   = 0;
+		lowerBoundComponents.book   = 0;
+		lowerBoundComponents.chap   = 0;
+		lowerBoundComponents.verse  = 0;
+		lowerBoundComponents.suffix = 0;
 
 	}
 	else tmpClone->setLocale(getLocale());

Modified: trunk/tests/testsuite/versekeytest.good
===================================================================
--- trunk/tests/testsuite/versekeytest.good	2010-03-20 13:43:42 UTC (rev 2507)
+++ trunk/tests/testsuite/versekeytest.good	2010-03-23 09:19:15 UTC (rev 2508)
@@ -43,6 +43,9 @@
 
 Book math
 
+Mark.1.1-- = Matthew 28:20
+++ = Mark 1:1
+.Chapter(.Chapter() - 1) = Matthew 28:1
 Matthew.1.1-- = Malachi 4:6
 ++ = Matthew 1:1
 .Book(.Book() - 1) = Malachi 1:1

Modified: trunk/tests/testsuite/verseparsing.good
===================================================================
--- trunk/tests/testsuite/verseparsing.good	2010-03-20 13:43:42 UTC (rev 2507)
+++ trunk/tests/testsuite/verseparsing.good	2010-03-23 09:19:15 UTC (rev 2508)
@@ -53,8 +53,12 @@
 1Jn 1:1; 3:10: I John 1:1; I John 3:10
 1Jn 1:1 ;3:10: I John 1:1; I John 3:10
 1Jn 1:1 ; 3:10: I John 1:1; I John 3:10
-1Jn1.1f ; 3:10ff: I John 1:1-I John 1:2; I John 3:10-I John 3:24
-1Jn1.1ff ; 3:10f: I John 1:1-I John 1:10; I John 3:10-I John 3:11
+1Jn 1:1a ; 3:10b: I John 1:1a; I John 3:10b
+1Jn 1:1-2a; 3:10b-11: I John 1:1-Revelation of John 22:21; I John 3:10b-I John 3:11
+1Jn 1:1c;3:10d-12e,13: I John 1:1c; I John 3:10d; I John 3:13
+1Jn1.1f; 3:10ff: I John 1:1-I John 1:2; I John 3:10-I John 3:24
+1Jn1.1ff;3:10f: I John 1:1-I John 1:10; I John 3:10-I John 3:11
+1Jn1.1,8ff; 3:10-12,14f,17ff: I John 1:1; I John 1:8-I John 1:10; I John 3:10-I John 3:12; I John 3:14-I John 3:15; I John 3:17-I John 3:24
 Gen: Genesis 1:1-Genesis 50:26
 Genes: Genesis 1:1-Genesis 50:26
 Exod: Exodus 1:1-Exodus 40:38

Modified: trunk/tests/testsuite/verseparsing.sh
===================================================================
--- trunk/tests/testsuite/verseparsing.sh	2010-03-20 13:43:42 UTC (rev 2507)
+++ trunk/tests/testsuite/verseparsing.sh	2010-03-23 09:19:15 UTC (rev 2508)
@@ -80,9 +80,16 @@
 ../parsekey "1Jn 1:1; 3:10"
 ../parsekey "1Jn 1:1 ;3:10"
 ../parsekey "1Jn 1:1 ; 3:10"
-../parsekey "1Jn1.1f ; 3:10ff"
-../parsekey "1Jn1.1ff ; 3:10f"
+../parsekey "1Jn 1:1a ; 3:10b"
 
+### These two are not quite right yet
+../parsekey "1Jn 1:1-2a; 3:10b-11"
+../parsekey "1Jn 1:1c;3:10d-12e,13"
+
+../parsekey "1Jn1.1f; 3:10ff"
+../parsekey "1Jn1.1ff;3:10f"
+../parsekey "1Jn1.1,8ff; 3:10-12,14f,17ff"
+
 en_abbrevs="
 Gen Genes Exod Ex Exo Lev Le Levi Num Nu Numb Deut Deu De Josh Jos Joshu
 Judg Jdg Judge Ruth Ru Rut 1Sam 1Sa 1Samu 2Sam 2Sa 2Samu 1Kgs 1Ki 1King

Modified: trunk/tests/versekeytest.cpp
===================================================================
--- trunk/tests/versekeytest.cpp	2010-03-20 13:43:42 UTC (rev 2507)
+++ trunk/tests/versekeytest.cpp	2010-03-23 09:19:15 UTC (rev 2508)
@@ -221,6 +221,14 @@
 
 	cout << "\nBook math\n\n";
 
+	vkey = "Mark.1.1";
+	vkey--;
+	cout << "Mark.1.1-- = " << vkey << "\n";
+	vkey++;
+	cout << "++ = " << vkey << "\n";
+	vkey.Chapter(vkey.Chapter() - 1);
+	cout << ".Chapter(.Chapter() - 1) = " << vkey << "\n";
+
 	vkey = "Matthew.1.1";
 	vkey--;
 	cout << "Matthew.1.1-- = " << vkey << "\n";




More information about the sword-cvs mailing list