summaryrefslogtreecommitdiff
path: root/tests/listtest.cpp
blob: fa94dcf9f735efee0eea696f4cb4382c587d6cf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <listkey.h>
#include <versekey.h>
#ifndef NO_SWORD_NAMESPACE
using namespace sword;
#endif

int main(int argc, char **argv)
{
	ListKey lk, lk2;
	VerseKey vk("jn 1:1", "jn 1:12");
	VerseKey vk2("jude", "jude");
	SWKey text;

	vk = "jas 1:19";
	text = (const char *)vk;
	lk << text;
	lk << text;
	lk << text;
	lk << "James 1:19";
	lk << "yoyo";
	lk << vk;
	lk2 << "test1";
	lk2 << lk;
	lk2 << vk2;
	lk2 << "test2";
	for (lk2 = TOP; !lk2.Error(); lk2++)
		std::cout << (const char *) lk2 << "\n";


	lk2 = VerseKey().ParseVerseList("mat-mark", 0, true);

	VerseKey yoyo("john");
	yoyo = MAXCHAPTER;
	std::cout << yoyo;
/*

	for (int i = 0; i < 2; i++) {
	VerseKey x, y;
	ListKey lk3;
	x = "rev";
	y = x;
	x = "mat";
	VerseKey newElement;
	newElement.LowerBound(x);
	newElement.UpperBound(y);
	lk3 << newElement;

	lk2 << lk3;
	}

*/
	std::cout << "---------\n";

	for (lk2 = TOP; !lk2.Error(); lk2++)
		std::cout << (const char *) lk2 << "\n";

	lk.ClearList();
	lk << "john 3:16";
	std::cout << "\nCount should be 1: " << lk.Count();

	lk = vk.ParseVerseList("mat;mark;luke", vk, true);
	lk = (VerseKey)"john 3:16";
	std::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");

	std::cout << "\n\n";
	return 0;
}