[sword-svn] r2266 - trunk/tests

scribe at crosswire.org scribe at crosswire.org
Tue Feb 17 08:09:13 MST 2009


Author: scribe
Date: 2009-02-17 08:09:13 -0700 (Tue, 17 Feb 2009)
New Revision: 2266

Added:
   trunk/tests/versemgrtest.cpp
Modified:
   trunk/tests/Makefile.am
Log:
added a new test for versemgr



Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am	2009-02-17 07:59:47 UTC (rev 2265)
+++ trunk/tests/Makefile.am	2009-02-17 15:09:13 UTC (rev 2266)
@@ -4,7 +4,7 @@
 
 SUBDIRS = cppunit
 
-noinst_PROGRAMS = ciphertest keytest mgrtest parsekey versekeytest listtest casttest \
+noinst_PROGRAMS = ciphertest keytest mgrtest parsekey versekeytest versemgrtest listtest casttest \
 modtest compnone complzss localetest introtest indextest configtest keycast \
 romantest testblocks filtertest rawldidxtest lextest swaptest \
  swbuftest xmltest webiftest
@@ -41,6 +41,7 @@
 ciphertest_SOURCES = ciphertest.cpp
 parsekey_SOURCES = parsekey.cpp
 versekeytest_SOURCES = versekeytest.cpp
+versemgrtest_SOURCES = versemgrtest.cpp
 listtest_SOURCES = listtest.cpp
 casttest_SOURCES = casttest.cpp
 modtest_SOURCES = modtest.cpp

Added: trunk/tests/versemgrtest.cpp
===================================================================
--- trunk/tests/versemgrtest.cpp	                        (rev 0)
+++ trunk/tests/versemgrtest.cpp	2009-02-17 15:09:13 UTC (rev 2266)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ *	CrossWire Bible Society
+ *	P. O. Box 2528
+ *	Tempe, AZ  85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <versemgr.h>
+#ifndef NO_SWORD_NAMESPACE
+using namespace sword;
+#endif
+
+using std::cout;
+using std::endl;
+
+int main(int argc, char **argv) {
+	VerseMgr *vmgr = VerseMgr::getSystemVerseMgr();
+	const VerseMgr::System *system = vmgr->getVersificationSystem("KJV");
+
+	int book, chapter, verse;
+	for (long offset = 0; offset < 31000; offset++) {
+		system->getVerseFromOffset(offset, &book, &chapter, &verse);
+		cout << "offset: " << offset << "; book: " << book << "; chapter: " << chapter << "; verse: " << verse << "\n";
+	}
+	cout << endl;
+
+	return 0;
+}




More information about the sword-cvs mailing list