aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/llapp_tut.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/test/llapp_tut.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/test/llapp_tut.cpp')
-rw-r--r--linden/indra/test/llapp_tut.cpp153
1 files changed, 153 insertions, 0 deletions
diff --git a/linden/indra/test/llapp_tut.cpp b/linden/indra/test/llapp_tut.cpp
new file mode 100644
index 0000000..a238cb3
--- /dev/null
+++ b/linden/indra/test/llapp_tut.cpp
@@ -0,0 +1,153 @@
1/**
2 * @file llapp_tut.cpp
3 * @author Phoenix
4 * @date 2006-09-12
5 *
6 * Copyright (c) 2006-2007, Linden Research, Inc.
7 *
8 * The source code in this file ("Source Code") is provided by Linden Lab
9 * to you under the terms of the GNU General Public License, version 2.0
10 * ("GPL"), unless you have obtained a separate licensing agreement
11 * ("Other License"), formally executed by you and Linden Lab. Terms of
12 * the GPL can be found in doc/GPL-license.txt in this distribution, or
13 * online at http://secondlife.com/developers/opensource/gplv2
14 *
15 * There are special exceptions to the terms and conditions of the GPL as
16 * it is applied to this Source Code. View the full text of the exception
17 * in the file doc/FLOSS-exception.txt in this software distribution, or
18 * online at http://secondlife.com/developers/opensource/flossexception
19 *
20 * By copying, modifying or distributing this software, you acknowledge
21 * that you have read and understood your obligations described above,
22 * and agree to abide by those obligations.
23 *
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE.
27 */
28
29#include <tut/tut.h>
30
31#include "linden_common.h"
32#include "llapp.h"
33#include "lltut.h"
34
35
36namespace tut
37{
38 struct application
39 {
40 class LLTestApp : public LLApp
41 {
42 public:
43 virtual bool init() { return true; }
44 virtual bool cleanup() { return true; }
45 virtual bool mainLoop() { return true; }
46 };
47 LLTestApp* mApp;
48 application()
49 {
50 mApp = new LLTestApp;
51 }
52 ~application()
53 {
54 delete mApp;
55 }
56 };
57
58 typedef test_group<application> application_t;
59 typedef application_t::object application_object_t;
60 tut::application_t tut_application("application");
61
62 template<> template<>
63 void application_object_t::test<1>()
64 {
65 LLSD defaults;
66 defaults["template"] = "../../scripts/messages/message_template.msg";
67 defaults["configdir"] = ".";
68 defaults["db_host"] = "mysql.durga.lindenlab.com";
69 defaults["db_user"] = "linden";
70 defaults["db_password"] = "gomez";
71 defaults["datadir"] = "data";
72 mApp->setOptionData(LLApp::PRIORITY_DEFAULT, defaults);
73
74 LLSD db_user_sd = mApp->getOption("db_user");
75 ensure_equals("data type", db_user_sd.type(), LLSD::TypeString);
76 ensure_equals(
77 "data value", db_user_sd.asString(), std::string("linden"));
78 }
79
80 template<> template<>
81 void application_object_t::test<2>()
82 {
83 const int ARGC = 13;
84 char* ARGV[ARGC] =
85 {
86 "", // argv[0] is usually the application name
87 "-crashcount",
88 "2",
89 "-space",
90 "spaceserver.grid.lindenlab.com",
91 "-db_host",
92 "localhost",
93 "--allowlslhttprequests",
94 "-asset-uri",
95 "http://asset.grid.lindenlab.com/assets",
96 "-data",
97 "127.0.0.1",
98 "--smtp"
99 };
100 bool ok = mApp->parseCommandOptions(ARGC, ARGV);
101 ensure("command line parsed", ok);
102 ensure_equals(
103 "crashcount", mApp->getOption("crashcount").asInteger(), 2);
104 ensure_equals(
105 "space",
106 mApp->getOption("space").asString(),
107 std::string("spaceserver.grid.lindenlab.com"));
108 ensure_equals(
109 "db_host",
110 mApp->getOption("db_host").asString(),
111 std::string("localhost"));
112 ensure("allowlshlttprequests", mApp->getOption("smtp"));
113 ensure_equals(
114 "asset-uri",
115 mApp->getOption("asset-uri").asString(),
116 std::string("http://asset.grid.lindenlab.com/assets"));
117 ensure_equals(
118 "data",
119 mApp->getOption("data").asString(),
120 std::string("127.0.0.1"));
121 ensure("smtp", mApp->getOption("smtp"));
122 }
123
124 template<> template<>
125 void application_object_t::test<3>()
126 {
127 const int ARGC = 4;
128 char* ARGV[ARGC] =
129 {
130 "", // argv[0] is usually the application name
131 "crashcount",
132 "2",
133 "--space"
134 };
135 bool ok = mApp->parseCommandOptions(ARGC, ARGV);
136 ensure("command line parse failure", !ok);
137 }
138
139 template<> template<>
140 void application_object_t::test<4>()
141 {
142 const int ARGC = 4;
143 char* ARGV[ARGC] =
144 {
145 "", // argv[0] is usually the application name
146 "--crashcount",
147 "2",
148 "space"
149 };
150 bool ok = mApp->parseCommandOptions(ARGC, ARGV);
151 ensure("command line parse failure", !ok);
152 }
153}