summaryrefslogtreecommitdiff
path: root/tests/parsekey.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parsekey.cpp')
-rw-r--r--tests/parsekey.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/parsekey.cpp b/tests/parsekey.cpp
new file mode 100644
index 0000000..5a37b8e
--- /dev/null
+++ b/tests/parsekey.cpp
@@ -0,0 +1,31 @@
+#include <iostream.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <versekey.h>
+#include <localemgr.h>
+
+int main(int argc, char **argv) {
+ if ((argc != 2) && (argc != 3)) {
+ fprintf(stderr, "usage: %s <\"string to parse\"> [locale name]\n", *argv);
+ exit(-1);
+ }
+
+ if (argc == 3)
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName(argv[2]);
+
+ VerseKey DefaultVSKey;
+
+ DefaultVSKey = "jas3:1";
+
+ ListKey verses = DefaultVSKey.ParseVerseList(argv[1], DefaultVSKey, true);
+
+ for (int i = 0; i < verses.Count(); i++) {
+ VerseKey *element = dynamic_cast<VerseKey *>(verses.GetElement(i));
+ if (element) {
+ cout << (string(element->LowerBound()) + " - " + string(element->UpperBound())).c_str() << "\n";
+ }
+ else cout << (const char *)*verses.GetElement(i) << "\n";
+ }
+ return 0;
+}