PageRenderTime 17ms CodeModel.GetById 1ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llinventory/tests/llparcel_test.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 69 lines | 32 code | 10 blank | 27 comment | 1 complexity | 95b389eeb7bfb35bf489c571a1d3f385 MD5 | raw file
 1/** 
 2 * @file llinventoryparcel_tut.cpp
 3 * @author Moss
 4 * @date 2007-04-17
 5 *
 6 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
 7 * Second Life Viewer Source Code
 8 * Copyright (C) 2010, Linden Research, Inc.
 9 * 
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation;
13 * version 2.1 of the License only.
14 * 
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 * 
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 * 
24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
25 * $/LicenseInfo$
26 */
27
28#include <string>
29
30#include "linden_common.h"
31
32#include "../llparcel.h"
33
34#include "../test/lltut.h"
35
36namespace tut
37{
38	struct llinventoryparcel_data
39	{
40	};
41	typedef test_group<llinventoryparcel_data> llinventoryparcel_test;
42	typedef llinventoryparcel_test::object llinventoryparcel_object;
43	tut::llinventoryparcel_test llinventoryparcel("LLInventoryParcel");
44
45	template<> template<>
46	void llinventoryparcel_object::test<1>()
47	{
48		for (S32 i=0; i<LLParcel::C_COUNT; ++i)
49		{
50			const std::string& catstring =  LLParcel::getCategoryString(LLParcel::ECategory(i));
51			ensure("LLParcel::getCategoryString(i)",
52			       !catstring.empty());
53
54			const std::string& catuistring =  LLParcel::getCategoryUIString(LLParcel::ECategory(i));
55			ensure("LLParcel::getCategoryUIString(i)",
56			       !catuistring.empty());
57
58			ensure_equals("LLParcel::ECategory mapping of string back to enum", LLParcel::getCategoryFromString(catstring), i);
59			ensure_equals("LLParcel::ECategory mapping of uistring back to enum", LLParcel::getCategoryFromUIString(catuistring), i);
60		}
61
62		// test the C_ANY case, which has to work for UI strings
63		const std::string& catuistring =  LLParcel::getCategoryUIString(LLParcel::C_ANY);
64		ensure("LLParcel::getCategoryUIString(C_ANY)",
65		       !catuistring.empty());
66
67		ensure_equals("LLParcel::ECategory mapping of uistring back to enum", LLParcel::getCategoryFromUIString(catuistring), LLParcel::C_ANY);
68	}
69}