aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/lluserrelations_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/lluserrelations_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/lluserrelations_tut.cpp')
-rw-r--r--linden/indra/test/lluserrelations_tut.cpp157
1 files changed, 157 insertions, 0 deletions
diff --git a/linden/indra/test/lluserrelations_tut.cpp b/linden/indra/test/lluserrelations_tut.cpp
new file mode 100644
index 0000000..e683803
--- /dev/null
+++ b/linden/indra/test/lluserrelations_tut.cpp
@@ -0,0 +1,157 @@
1/**
2 * @file lluserrelations_tut.cpp
3 * @author Phoenix
4 * @date 2006-10-12
5 * @brief Unit tests for the LLRelationship class.
6 *
7 * Copyright (c) 2006-2007, Linden Research, Inc.
8 *
9 * The source code in this file ("Source Code") is provided by Linden Lab
10 * to you under the terms of the GNU General Public License, version 2.0
11 * ("GPL"), unless you have obtained a separate licensing agreement
12 * ("Other License"), formally executed by you and Linden Lab. Terms of
13 * the GPL can be found in doc/GPL-license.txt in this distribution, or
14 * online at http://secondlife.com/developers/opensource/gplv2
15 *
16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlife.com/developers/opensource/flossexception
20 *
21 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above,
23 * and agree to abide by those obligations.
24 *
25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
27 * COMPLETENESS OR PERFORMANCE.
28 */
29
30#include <tut/tut.h>
31
32#include "linden_common.h"
33#include "lluserrelations.h"
34
35namespace tut
36{
37 struct user_relationship
38 {
39 LLRelationship mRelationship;
40 };
41 typedef test_group<user_relationship> user_relationship_t;
42 typedef user_relationship_t::object user_relationship_object_t;
43 tut::user_relationship_t tut_user_relationship("relationships");
44
45 template<> template<>
46 void user_relationship_object_t::test<1>()
47 {
48 // Test the default construction
49 ensure(
50 "No granted rights to",
51 !mRelationship.isRightGrantedTo(
52 LLRelationship::GRANT_ONLINE_STATUS));
53 ensure(
54 "No granted rights from",
55 !mRelationship.isRightGrantedFrom(
56 LLRelationship::GRANT_ONLINE_STATUS));
57 ensure("No online status",!mRelationship.isOnline());
58 }
59
60 template<> template<>
61 void user_relationship_object_t::test<2>()
62 {
63 // Test some granting
64 mRelationship.grantRights(
65 LLRelationship::GRANT_ONLINE_STATUS,
66 LLRelationship::GRANT_MODIFY_OBJECTS);
67 ensure(
68 "Granted rights to has online",
69 mRelationship.isRightGrantedTo(
70 LLRelationship::GRANT_ONLINE_STATUS));
71 ensure(
72 "Granted rights from does not have online",
73 !mRelationship.isRightGrantedFrom(
74 LLRelationship::GRANT_ONLINE_STATUS));
75 ensure(
76 "Granted rights to does not have modify",
77 !mRelationship.isRightGrantedTo(
78 LLRelationship::GRANT_MODIFY_OBJECTS));
79 ensure(
80 "Granted rights from has modify",
81 mRelationship.isRightGrantedFrom(
82 LLRelationship::GRANT_MODIFY_OBJECTS));
83 }
84
85 template<> template<>
86 void user_relationship_object_t::test<3>()
87 {
88 // Test revoking
89 mRelationship.grantRights(
90 LLRelationship::GRANT_ONLINE_STATUS
91 | LLRelationship::GRANT_MAP_LOCATION,
92 LLRelationship::GRANT_ONLINE_STATUS);
93 ensure(
94 "Granted rights to has online and map",
95 mRelationship.isRightGrantedTo(
96 LLRelationship::GRANT_ONLINE_STATUS
97 | LLRelationship::GRANT_MAP_LOCATION));
98 ensure(
99 "Granted rights from has online",
100 mRelationship.isRightGrantedFrom(
101 LLRelationship::GRANT_ONLINE_STATUS));
102
103 mRelationship.revokeRights(
104 LLRelationship::GRANT_MAP_LOCATION,
105 LLRelationship::GRANT_NONE);
106 ensure(
107 "Granted rights revoked map",
108 !mRelationship.isRightGrantedTo(
109 LLRelationship::GRANT_ONLINE_STATUS
110 | LLRelationship::GRANT_MAP_LOCATION));
111 ensure(
112 "Granted rights revoked still has online",
113 mRelationship.isRightGrantedTo(
114 LLRelationship::GRANT_ONLINE_STATUS));
115
116 mRelationship.grantRights(
117 LLRelationship::GRANT_NONE,
118 LLRelationship::GRANT_MODIFY_OBJECTS);
119 ensure(
120 "Granted rights from still has online",
121 mRelationship.isRightGrantedFrom(
122 LLRelationship::GRANT_ONLINE_STATUS));
123 ensure(
124 "Granted rights from has full grant",
125 mRelationship.isRightGrantedFrom(
126 LLRelationship::GRANT_ONLINE_STATUS
127 | LLRelationship::GRANT_MODIFY_OBJECTS));
128 mRelationship.revokeRights(
129 LLRelationship::GRANT_NONE,
130 LLRelationship::GRANT_MODIFY_OBJECTS);
131 ensure(
132 "Granted rights from still has online",
133 mRelationship.isRightGrantedFrom(
134 LLRelationship::GRANT_ONLINE_STATUS));
135 ensure(
136 "Granted rights from no longer modify",
137 !mRelationship.isRightGrantedFrom(
138 LLRelationship::GRANT_MODIFY_OBJECTS));
139 }
140
141 template<> template<>
142 void user_relationship_object_t::test<4>()
143 {
144 ensure("No online status", !mRelationship.isOnline());
145 mRelationship.online(true);
146 ensure("Online status", mRelationship.isOnline());
147 mRelationship.online(false);
148 ensure("No online status", !mRelationship.isOnline());
149 }
150
151/*
152 template<> template<>
153 void user_relationship_object_t::test<>()
154 {
155 }
156*/
157}