[sword-svn] r2301 - in trunk/tests: . testsuite
scribe at crosswire.org
scribe at crosswire.org
Mon Apr 6 04:22:46 MST 2009
Author: scribe
Date: 2009-04-06 04:22:46 -0700 (Mon, 06 Apr 2009)
New Revision: 2301
Added:
trunk/tests/testsuite/listtest.good
trunk/tests/testsuite/listtest.sh
Modified:
trunk/tests/listtest.cpp
Log:
Expanding listtest slightly and adding it to testsuite
Modified: trunk/tests/listtest.cpp
===================================================================
--- trunk/tests/listtest.cpp 2009-04-04 00:53:50 UTC (rev 2300)
+++ trunk/tests/listtest.cpp 2009-04-06 11:22:46 UTC (rev 2301)
@@ -22,17 +22,33 @@
#include <versekey.h>
#ifndef NO_SWORD_NAMESPACE
using namespace sword;
+using namespace std;
#endif
int main(int argc, char **argv)
{
+ // simple bounds check on verse first before we try this with listkey
+ SWKey text;
+ VerseKey vk("jn 1:1", "jn 1:12");
+ vk = "jas 1:19";
+ cout << "\nError should be set: " << ((vk.Error()) ? "set":"not set");
+ text = (const char *)vk;
+ cout << "\nshould be jn 1.12: " << text << "\n";
+ vk = "mat 1:19";
+ cout << "\nError should be set: " << ((vk.Error()) ? "set":"not set");
+ text = (const char *)vk;
+ cout << "\nshould be jn 1.1: " << text << "\n";
+ vk = "jn 1:7";
+ cout << "\nError should not be set: " << ((vk.Error()) ? "set":"not set");
+ text = (const char *)vk;
+ cout << "\nshould be jn 1.7: " << text << "\n";
+
+ // complex listkey in listkey text
ListKey lk, lk2;
- VerseKey vk("jn 1:1", "jn 1:12");
+
+ // c-tor bound setting
VerseKey vk2("jude", "jude");
- SWKey text;
- vk = "jas 1:19";
- text = (const char *)vk;
lk << text;
lk << text;
lk << text;
@@ -43,15 +59,20 @@
lk2 << lk;
lk2 << vk2;
lk2 << "test2";
- for (lk2 = TOP; !lk2.Error(); lk2++)
- std::cout << (const char *) lk2 << "\n";
+ for (lk2 = TOP; !lk2.Error(); lk2++) {
+ cout << (const char *) lk2 << "\n";
+ }
+ cout << "\n\n---------\n";
- lk2 = VerseKey().ParseVerseList("mat-mark", 0, true);
+ lk2 = VerseKey().ParseVerseList("1jn-2jn;mk1.9", 0, true);
+ // c-tor not bound setting, just parsing to jn.1.1
VerseKey yoyo("john");
yoyo = MAXCHAPTER;
- std::cout << yoyo;
+ cout << "should be jn.21.1: " << yoyo << "\n";
+
+ lk2 << yoyo;
/*
for (int i = 0; i < 2; i++) {
@@ -69,22 +90,25 @@
}
*/
- std::cout << "---------\n";
for (lk2 = TOP; !lk2.Error(); lk2++)
- std::cout << (const char *) lk2 << "\n";
+ cout << (const char *) lk2 << "\n";
lk.ClearList();
lk << "john 3:16";
- std::cout << "\nCount should be 1: " << lk.Count();
+ cout << "\nCount should be 1: " << lk.Count();
lk = vk.ParseVerseList("mat;mark;luke", vk, true);
+ lk = (VerseKey)"mark 3:16";
+ cout << "\nError should not be set: " << ((lk.Error()) ? "set":"not set");
lk = (VerseKey)"john 3:16";
- std::cout << "\nError should be set: " << ((lk.Error()) ? "set":"not set");
+ cout << "\nError should be set: " << ((lk.Error()) ? "set":"not set");
lk = vk.ParseVerseList("mk 3:16", vk, true);
lk = (VerseKey)"john 3:16";
- std::cout << "\nError should be set: " << ((lk.Error()) ? "set":"not set");
+ cout << "\nError should be set: " << ((lk.Error()) ? "set":"not set");
+ lk = (VerseKey)"mark 3:16";
+ cout << "\nError should not be set: " << ((lk.Error()) ? "set":"not set");
- std::cout << "\n\n";
+ cout << "\n\n";
return 0;
}
Added: trunk/tests/testsuite/listtest.good
===================================================================
--- trunk/tests/testsuite/listtest.good (rev 0)
+++ trunk/tests/testsuite/listtest.good 2009-04-06 11:22:46 UTC (rev 2301)
@@ -0,0 +1,184 @@
+
+Error should be set: set
+should be jn 1.12: John 1:12
+
+Error should be set: set
+should be jn 1.1: John 1:1
+
+Error should not be set: not set
+should be jn 1.7: John 1:7
+test1
+John 1:7
+John 1:7
+John 1:7
+James 1:19
+yoyo
+John 1:1
+John 1:2
+John 1:3
+John 1:4
+John 1:5
+John 1:6
+John 1:7
+John 1:8
+John 1:9
+John 1:10
+John 1:11
+John 1:12
+Jude 1:1
+Jude 1:2
+Jude 1:3
+Jude 1:4
+Jude 1:5
+Jude 1:6
+Jude 1:7
+Jude 1:8
+Jude 1:9
+Jude 1:10
+Jude 1:11
+Jude 1:12
+Jude 1:13
+Jude 1:14
+Jude 1:15
+Jude 1:16
+Jude 1:17
+Jude 1:18
+Jude 1:19
+Jude 1:20
+Jude 1:21
+Jude 1:22
+Jude 1:23
+Jude 1:24
+Jude 1:25
+test2
+
+
+---------
+should be jn.21.1: John 21:1
+I John 1:1
+I John 1:2
+I John 1:3
+I John 1:4
+I John 1:5
+I John 1:6
+I John 1:7
+I John 1:8
+I John 1:9
+I John 1:10
+I John 2:1
+I John 2:2
+I John 2:3
+I John 2:4
+I John 2:5
+I John 2:6
+I John 2:7
+I John 2:8
+I John 2:9
+I John 2:10
+I John 2:11
+I John 2:12
+I John 2:13
+I John 2:14
+I John 2:15
+I John 2:16
+I John 2:17
+I John 2:18
+I John 2:19
+I John 2:20
+I John 2:21
+I John 2:22
+I John 2:23
+I John 2:24
+I John 2:25
+I John 2:26
+I John 2:27
+I John 2:28
+I John 2:29
+I John 3:1
+I John 3:2
+I John 3:3
+I John 3:4
+I John 3:5
+I John 3:6
+I John 3:7
+I John 3:8
+I John 3:9
+I John 3:10
+I John 3:11
+I John 3:12
+I John 3:13
+I John 3:14
+I John 3:15
+I John 3:16
+I John 3:17
+I John 3:18
+I John 3:19
+I John 3:20
+I John 3:21
+I John 3:22
+I John 3:23
+I John 3:24
+I John 4:1
+I John 4:2
+I John 4:3
+I John 4:4
+I John 4:5
+I John 4:6
+I John 4:7
+I John 4:8
+I John 4:9
+I John 4:10
+I John 4:11
+I John 4:12
+I John 4:13
+I John 4:14
+I John 4:15
+I John 4:16
+I John 4:17
+I John 4:18
+I John 4:19
+I John 4:20
+I John 4:21
+I John 5:1
+I John 5:2
+I John 5:3
+I John 5:4
+I John 5:5
+I John 5:6
+I John 5:7
+I John 5:8
+I John 5:9
+I John 5:10
+I John 5:11
+I John 5:12
+I John 5:13
+I John 5:14
+I John 5:15
+I John 5:16
+I John 5:17
+I John 5:18
+I John 5:19
+I John 5:20
+I John 5:21
+II John 1:1
+II John 1:2
+II John 1:3
+II John 1:4
+II John 1:5
+II John 1:6
+II John 1:7
+II John 1:8
+II John 1:9
+II John 1:10
+II John 1:11
+II John 1:12
+II John 1:13
+Mark 1:9
+John 21:1
+
+Count should be 1: 1
+Error should not be set: not set
+Error should be set: set
+Error should be set: set
+Error should not be set: not set
+
Added: trunk/tests/testsuite/listtest.sh
===================================================================
--- trunk/tests/testsuite/listtest.sh (rev 0)
+++ trunk/tests/testsuite/listtest.sh 2009-04-06 11:22:46 UTC (rev 2301)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+../listtest
Property changes on: trunk/tests/testsuite/listtest.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the sword-cvs
mailing list