PageRenderTime 80ms CodeModel.GetById 2ms app.highlight 73ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/test/llpermissions_tut.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 533 lines | 424 code | 71 blank | 38 comment | 28 complexity | 6707a7edb43514f249ec694c48992113 MD5 | raw file
  1/**
  2 * @file llpermissions_tut.cpp
  3 * @author Adroit
  4 * @date March 2007
  5 * @brief llpermissions test cases.
  6 *
  7 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  8 * Second Life Viewer Source Code
  9 * Copyright (C) 2010, Linden Research, Inc.
 10 * 
 11 * This library is free software; you can redistribute it and/or
 12 * modify it under the terms of the GNU Lesser General Public
 13 * License as published by the Free Software Foundation;
 14 * version 2.1 of the License only.
 15 * 
 16 * This library is distributed in the hope that it will be useful,
 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 19 * Lesser General Public License for more details.
 20 * 
 21 * You should have received a copy of the GNU Lesser General Public
 22 * License along with this library; if not, write to the Free Software
 23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 24 * 
 25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 26 * $/LicenseInfo$
 27 */
 28 
 29#include <tut/tut.hpp>
 30#include "linden_common.h"
 31#include "lltut.h"
 32#include "message.h"
 33#include "llpermissions.h"
 34
 35
 36namespace tut
 37{
 38	struct permission
 39	{
 40	};
 41	typedef test_group<permission> permission_t;
 42	typedef permission_t::object permission_object_t;
 43	tut::permission_t tut_permission("permission");
 44
 45	template<> template<>
 46	void permission_object_t::test<1>()
 47	{
 48		LLPermissions permissions;
 49		LLUUID	uuid = permissions.getCreator();
 50		LLUUID	uuid1 = permissions.getOwner(); 
 51		LLUUID	uuid2 = permissions.getGroup();
 52		LLUUID	uuid3 = permissions.getLastOwner(); 
 53
 54		ensure("LLPermission Get Functions failed", (uuid == LLUUID::null && uuid1 == LLUUID::null && 
 55			uuid2 == LLUUID::null && uuid3 == LLUUID::null));
 56		ensure("LLPermission Get Functions failed", (permissions.getMaskBase() == PERM_ALL && permissions.getMaskOwner() == PERM_ALL && 
 57			permissions.getMaskGroup() == PERM_ALL && permissions.getMaskEveryone() == PERM_ALL && permissions.getMaskNextOwner() == PERM_ALL));
 58		ensure("Ownership functions failed", ((! permissions.isGroupOwned()) && (! permissions.isOwned())));
 59	}
 60
 61	template<> template<>
 62	void permission_object_t::test<2>()
 63	{
 64		LLPermissions permissions;
 65		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
 66		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
 67		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
 68		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
 69		permissions.init(creator, owner, lastOwner, group);
 70
 71		ensure_equals("init/getCreator():failed to return the creator ", creator, permissions.getCreator());	
 72		ensure_equals("init/getOwner():failed to return the owner ", owner, permissions.getOwner());
 73		ensure_equals("init/getLastOwner():failed to return the group ", lastOwner, permissions.getLastOwner());	
 74		ensure_equals("init/getGroup():failed to return the group ", group, permissions.getGroup());	
 75	}
 76
 77	template<> template<>
 78	void permission_object_t::test<3>()
 79	{
 80		LLPermissions permissions;
 81		U32 base = PERM_ALL;
 82		U32 owner = PERM_ITEM_UNRESTRICTED; //PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
 83		U32 group = PERM_TRANSFER | PERM_MOVE | PERM_COPY|PERM_MODIFY;
 84		U32 everyone = PERM_TRANSFER | PERM_MOVE | PERM_MODIFY;
 85		U32 next = PERM_NONE;
 86
 87		U32 fixedbase = base;
 88		U32 fixedowner = PERM_ITEM_UNRESTRICTED; //owner & fixedbase
 89		U32 fixedgroup = PERM_ITEM_UNRESTRICTED; // no PERM_MOVE as owner does not have that perm either
 90		U32 fixedeveryone = PERM_TRANSFER; // no PERM_MOVE. Everyone can never modify.
 91		U32 fixednext = PERM_NONE;
 92
 93		permissions.initMasks(base, owner, everyone, group, next); // will fix perms if not allowed.
 94		ensure_equals("initMasks/getMaskBase():failed to return the MaskBase ", fixedbase, permissions.getMaskBase());	
 95		ensure_equals("initMasks/getMaskOwner():failed to return the MaskOwner ", fixedowner, permissions.getMaskOwner());	
 96		ensure_equals("initMasks/getMaskEveryone():failed to return the MaskGroup ", fixedgroup, permissions.getMaskGroup());	
 97		ensure_equals("initMasks/getMaskEveryone():failed to return the MaskEveryone ", fixedeveryone, permissions.getMaskEveryone());	
 98		ensure_equals("initMasks/getMaskNextOwner():failed to return the MaskNext ", fixednext, permissions.getMaskNextOwner());	
 99
100		// explictly set should maintain the values
101		permissions.setMaskBase(base); //no fixing
102		ensure_equals("setMaskBase/getMaskBase():failed to return the MaskBase ", base, permissions.getMaskBase());	
103
104		permissions.setMaskOwner(owner);
105		ensure_equals("setMaskOwner/getMaskOwner():failed to return the MaskOwner ", owner, permissions.getMaskOwner());	
106		
107		permissions.setMaskEveryone(everyone);
108		ensure_equals("setMaskEveryone/getMaskEveryone():failed to return the MaskEveryone ", everyone, permissions.getMaskEveryone());	
109
110		permissions.setMaskGroup(group);
111		ensure_equals("setMaskGroup/getMaskEveryone():failed to return the MaskGroup ", group, permissions.getMaskGroup());	
112
113		permissions.setMaskNext(next);
114		ensure_equals("setMaskNext/getMaskNextOwner():failed to return the MaskNext ", next, permissions.getMaskNextOwner());	
115
116		// further tests can be added to ensure perms for owner/group/everyone etc. get properly fixed. 
117		// code however suggests that there is no explict check if the perms are correct and the user of this 
118		// class is expected to know how to use them correctly. skipping further test cases for now for various
119		// perm combinations.
120	}
121
122	template<> template<>
123	void permission_object_t::test<4>()
124	{
125		LLPermissions perm,perm1;
126		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
127		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
128		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
129		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
130		perm1.init(creator,owner,lastOwner,group);
131		perm.set(perm1);
132		ensure("set():failed to set ", (creator == perm.getCreator()) && (owner == perm.getOwner())&&
133									(lastOwner == perm.getLastOwner())&& (group == perm.getGroup()));	
134		}
135
136	template<> template<>
137	void permission_object_t::test<5>()
138	{
139		LLPermissions perm,perm1;
140		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
141		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
142		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
143		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
144		perm1.init(creator,owner,lastOwner,group);
145
146		U32 base = PERM_TRANSFER;
147		U32 ownerp = PERM_TRANSFER;
148		U32 groupp = PERM_TRANSFER;
149		U32 everyone = PERM_TRANSFER;
150		U32 next = PERM_NONE;
151
152		perm1.initMasks(base, ownerp, everyone, groupp, next);
153
154		base = PERM_ALL;
155		ownerp = PERM_ITEM_UNRESTRICTED; //PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
156		groupp = PERM_TRANSFER | PERM_COPY|PERM_MODIFY;
157		everyone = PERM_TRANSFER;
158		next = PERM_NONE;
159		
160		perm.init(creator,owner,lastOwner,group);
161		perm.initMasks(base, ownerp, everyone, groupp, next); 
162
163		// restrict permissions by accumulation
164		perm.accumulate(perm1);
165
166		U32 fixedbase = PERM_TRANSFER | PERM_MOVE;
167		U32 fixedowner = PERM_TRANSFER;
168		U32 fixedgroup = PERM_TRANSFER;
169		U32 fixedeveryone = PERM_TRANSFER;
170		U32 fixednext = PERM_NONE;
171
172		ensure_equals("accumulate failed ", fixedbase, perm.getMaskBase());	
173		ensure_equals("accumulate failed ", fixedowner, perm.getMaskOwner());	
174		ensure_equals("accumulate failed ", fixedgroup, perm.getMaskGroup());	
175		ensure_equals("accumulate failed ", fixedeveryone, perm.getMaskEveryone());	
176		ensure_equals("accumulate failed ", fixednext, perm.getMaskNextOwner());	
177	}
178
179	template<> template<>
180	void permission_object_t::test<6>()
181	{
182		LLPermissions perm;
183		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
184		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
185		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
186		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
187		perm.init(creator,owner,lastOwner,group);
188		ensure_equals("getSafeOwner:failed ", owner,perm.getSafeOwner());
189		
190		///NULL Owner
191		perm.init(creator,LLUUID::null,lastOwner,group);
192		ensure_equals("getSafeOwner:failed ", group, perm.getSafeOwner());
193	}
194	
195		template<> template<>
196	void permission_object_t::test<7>()
197	{
198		LLPermissions perm1;
199		LLUUID uuid;
200		BOOL is_group_owned = FALSE;
201		ensure("1:getOwnership:failed ", ! perm1.getOwnership(uuid,is_group_owned));
202		
203		LLPermissions perm;
204		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
205		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
206		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
207		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
208		perm.init(creator,owner,lastOwner,group);
209		perm.getOwnership(uuid,is_group_owned);
210		ensure("2:getOwnership:failed ", ((uuid == owner) && (! is_group_owned))); 
211
212		perm.init(creator,LLUUID::null,lastOwner,group);
213		perm.getOwnership(uuid,is_group_owned);
214		ensure("3:getOwnership:failed ", ((uuid == group) && is_group_owned));
215	}
216
217	template<> template<>
218	void permission_object_t::test<8>()
219	{
220		LLPermissions perm,perm1;
221		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
222		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
223		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
224		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
225		perm.init(creator,owner,lastOwner,group);
226		perm1.init(creator,owner,lastOwner,group);
227		ensure_equals("getCRC32:failed ", perm.getCRC32(),perm1.getCRC32());
228	}
229
230	template<> template<>
231	void permission_object_t::test<9>()
232	{
233		LLPermissions perm;
234		LLUUID agent("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
235		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
236		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");
237		bool is_atomic = true;
238		ensure("setOwnerAndGroup():failed ", perm.setOwnerAndGroup(agent,owner,group,is_atomic));
239		
240		LLUUID owner2("68edcf47-ccd7-45b8-9f90-1649d7f12807"); 
241		LLUUID group2("9c8eca51-53d5-42a7-bb58-cef070395db9");
242		
243		// cant change - agent need to be current owner
244		ensure("setOwnerAndGroup():failed ", ! perm.setOwnerAndGroup(agent,owner2,group2,is_atomic));
245		
246		// should be able to change - agent and owner same as current owner
247		ensure("setOwnerAndGroup():failed ", perm.setOwnerAndGroup(owner,owner,group2,is_atomic));
248	}
249
250	template<> template<>
251	void permission_object_t::test<10>()
252	{
253		LLPermissions perm;
254		LLUUID agent;
255		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");
256		ensure("deedToGroup():failed ", perm.deedToGroup(agent,group));
257	}
258	template<> template<>
259	void permission_object_t::test<11>()
260	{
261		LLPermissions perm;
262		LLUUID agent;
263		BOOL set = 1;
264		U32 bits = PERM_TRANSFER | PERM_MODIFY;
265		ensure("setBaseBits():failed ", perm.setBaseBits(agent, set, bits));
266		ensure("setOwnerBits():failed ", perm.setOwnerBits(agent, set, bits));
267
268		LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8");
269		ensure("setBaseBits():failed ", ! perm.setBaseBits(agent1, set, bits));
270		ensure("setOwnerBits():failed ", ! perm.setOwnerBits(agent1, set, bits));
271	}
272
273	template<> template<>
274	void permission_object_t::test<12>()
275	{
276		LLPermissions perm;
277		LLUUID agent;
278		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
279		BOOL set = 1;
280		U32 bits = 10;
281		ensure("setGroupBits():failed ", perm.setGroupBits(agent,group, set, bits));
282		ensure("setEveryoneBits():failed ", perm.setEveryoneBits(agent,group, set, bits));
283		ensure("setNextOwnerBits():failed ", perm.setNextOwnerBits(agent,group, set, bits));
284
285		LLUUID agent1("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
286		ensure("setGroupBits():failed ", ! perm.setGroupBits(agent1,group, set, bits));
287		ensure("setEveryoneBits():failed ", ! perm.setEveryoneBits(agent1,group, set, bits));
288		ensure("setNextOwnerBits():failed ", ! perm.setNextOwnerBits(agent1,group, set, bits));
289	}
290
291	template<> template<>
292	void permission_object_t::test<13>()
293	{
294		LLPermissions perm;
295		LLUUID agent;
296		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
297		U32 bits = 10;
298		ensure("allowOperationBy():failed ", perm.allowOperationBy(bits,agent,group));
299
300		LLUUID agent1("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
301		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
302		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
303		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
304		perm.init(creator,owner,lastOwner,group);
305		ensure("allowOperationBy():failed ", perm.allowOperationBy(bits,agent1,group));
306	}
307
308	template<> template<>
309	void permission_object_t::test<14>()
310	{
311		LLPermissions perm;
312		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
313		LLUUID owner;
314		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
315		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
316		perm.init(creator,owner,lastOwner,group);
317		LLUUID agent;
318		ensure("1:allowModifyBy():failed ", perm.allowModifyBy(agent));
319		ensure("2:allowModifyBy():failed ", perm.allowModifyBy(agent,group));
320				
321		LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); 
322		ensure("3:allowModifyBy():failed ", perm.allowModifyBy(agent1));
323		ensure("4:allowModifyBy():failed ", perm.allowModifyBy(agent1,group));
324	}
325	
326	template<> template<>
327	void permission_object_t::test<15>()
328	{
329		LLPermissions perm;
330		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
331		LLUUID owner;
332		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
333		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
334		perm.init(creator,owner,lastOwner,group);
335		LLUUID agent;
336		ensure("1:allowCopyBy():failed ", perm.allowModifyBy(agent));
337		ensure("2:allowCopyBy():failed ", perm.allowModifyBy(agent,group));
338				
339		LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); 
340		ensure("3:allowCopyBy():failed ", perm.allowCopyBy(agent1));
341		ensure("4:allowCopyBy():failed ", perm.allowCopyBy(agent1,group));
342	}
343
344	template<> template<>
345	void permission_object_t::test<16>()
346	{
347		LLPermissions perm;
348		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
349		LLUUID owner;
350		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
351		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
352		perm.init(creator,owner,lastOwner,group);
353		LLUUID agent;
354		ensure("1:allowMoveBy():failed ", perm.allowMoveBy(agent));
355		ensure("2:allowMoveBy():failed ", perm.allowMoveBy(agent,group));
356
357		LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); 
358		ensure("3:allowMoveBy():failed ", perm.allowMoveBy(agent1));
359		ensure("4:allowMoveBy():failed ", perm.allowMoveBy(agent1,group));
360	}
361
362	template<> template<>
363	void permission_object_t::test<17>()
364	{
365		LLPermissions perm;
366		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
367		LLUUID owner;
368		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
369		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
370		LLUUID agent;
371		ensure("1:allowMoveBy():failed ", perm.allowTransferTo(agent));
372		
373		perm.init(creator,owner,lastOwner,group);
374		ensure("2:allowMoveBy():failed ", perm.allowTransferTo(agent));
375	}
376
377	template<> template<>
378	void permission_object_t::test<18>()
379	{
380		LLPermissions perm,perm1;
381		ensure_equals("1:Operator==:failed ", perm, perm1);
382		
383		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
384		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
385		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
386		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
387		perm.init(creator,owner,lastOwner,group);
388		perm = perm1;
389		ensure_equals("2:Operator==:failed ", perm, perm1);
390	}
391
392	template<> template<>
393	void permission_object_t::test<19>()
394	{
395		LLPermissions perm,perm1;
396		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
397		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
398		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
399		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
400		perm.init(creator,owner,lastOwner,group);
401		ensure_not_equals("2:Operator==:failed ", perm, perm1);
402	}
403
404	template<> template<>
405	void permission_object_t::test<20>()
406	{
407		LLFILE* fp = LLFile::fopen("linden_file.dat","w+");
408		if(!fp)
409		{
410			llerrs << "file coudnt be opened\n" << llendl;
411			return;
412		}
413		LLPermissions perm,perm1;
414		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
415		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
416		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
417		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
418		perm.init(creator,owner,lastOwner,group);
419		
420		U32 base = PERM_TRANSFER | PERM_COPY;
421		U32 ownerp = PERM_TRANSFER;
422		U32 groupp = PERM_TRANSFER;
423		U32 everyone = PERM_TRANSFER;
424		U32 next = PERM_NONE;
425
426		perm.initMasks(base, ownerp, everyone, groupp, next);
427
428		perm.exportFile(fp);
429		fclose(fp);	
430		fp = LLFile::fopen("linden_file.dat","r+");
431		if(!fp)
432		{
433			llerrs << "file coudnt be opened\n" << llendl;
434			return;
435		}
436		perm1.importFile(fp);
437		fclose(fp);
438		ensure_equals("exportFile()/importFile():failed to export and import the data ", perm1, perm);	
439}
440
441	template<> template<>
442	void permission_object_t::test<21>()
443	{
444		LLPermissions perm,perm1;
445		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
446		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
447		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
448		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
449		perm.init(creator,owner,lastOwner,group);
450
451		U32 base = PERM_TRANSFER | PERM_COPY;
452		U32 ownerp = PERM_TRANSFER;
453		U32 groupp = PERM_TRANSFER;
454		U32 everyone = PERM_TRANSFER;
455		U32 next = PERM_NONE;
456
457		perm.initMasks(base, ownerp, everyone, groupp, next);
458
459		std::ostringstream ostream;
460		perm.exportLegacyStream(ostream);
461		std::istringstream istream(ostream.str());
462		perm1.importLegacyStream(istream);
463
464		ensure_equals("exportLegacyStream()/importLegacyStream():failed to export and import the data ", perm1, perm);
465	}
466
467	template<> template<>
468	void permission_object_t::test<22>()
469	{
470		// Deleted LLPermissions::exportFileXML() and LLPermissions::importXML()
471		// because I can't find any non-test code references to it. 2009-05-04 JC
472	}
473
474	template<> template<>
475	void permission_object_t::test<23>()
476	{
477		LLPermissions perm,perm1;
478		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
479		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
480		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
481		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
482		perm.init(creator,owner,lastOwner,group);
483		std::ostringstream stream1, stream2;
484		stream1 << perm;
485		perm1.init(creator,owner,lastOwner,group);
486		stream2 << perm1;
487		ensure_equals("1:operator << failed", stream1.str(), stream2.str());
488	}
489
490	template<> template<>
491	void permission_object_t::test<24>()
492	{
493		LLPermissions perm,perm1;
494		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
495		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
496		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
497		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
498		perm.init(creator,owner,lastOwner,group);
499		
500		U32 base = PERM_TRANSFER | PERM_COPY;
501		U32 ownerp = PERM_TRANSFER;
502		U32 groupp = PERM_TRANSFER;
503		U32 everyone = PERM_TRANSFER;
504		U32 next = PERM_NONE;
505
506		perm.initMasks(base, ownerp, everyone, groupp, next);
507
508		LLSD sd = ll_create_sd_from_permissions(perm);
509		perm1 = ll_permissions_from_sd(sd);
510		ensure_equals("ll_permissions_from_sd() and ll_create_sd_from_permissions()functions failed", perm, perm1);
511	}
512
513	template<> template<>
514	void permission_object_t::test<25>()
515	{
516		LLAggregatePermissions AggrPermission;	
517		LLAggregatePermissions AggrPermission1;	
518		ensure_equals("getU8() function failed", AggrPermission.getU8(), 0);
519		ensure("isEmpty() function failed", AggrPermission.isEmpty());
520		AggrPermission.getValue(PERM_TRANSFER);
521		ensure_equals("getValue() function failed", AggrPermission.getValue(PERM_TRANSFER), 0x00);
522
523		AggrPermission.aggregate(PERM_ITEM_UNRESTRICTED);
524		ensure("aggregate() function failed", ! AggrPermission.isEmpty());
525
526		AggrPermission1.aggregate(AggrPermission);
527		ensure("aggregate() function failed", ! AggrPermission1.isEmpty());
528
529		std::ostringstream stream1;
530		stream1 << AggrPermission;
531		ensure_equals("operator<< failed", stream1.str(), "{PI_COPY=All, PI_MODIFY=All, PI_TRANSFER=All}");
532	}
533}