diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/test/lltut.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/linden/indra/test/lltut.h b/linden/indra/test/lltut.h new file mode 100644 index 0000000..ba3df24 --- /dev/null +++ b/linden/indra/test/lltut.h | |||
@@ -0,0 +1,95 @@ | |||
1 | /** | ||
2 | * @file lltut.h | ||
3 | * @author Phoenix | ||
4 | * @date 2005-09-26 | ||
5 | * @brief helper tut methods | ||
6 | * | ||
7 | * Copyright (c) 2005-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 | /** | ||
31 | * | ||
32 | * THOROUGH_DESCRIPTION | ||
33 | * | ||
34 | */ | ||
35 | |||
36 | #ifndef LL_LLTUT_H | ||
37 | #define LL_LLTUT_H | ||
38 | |||
39 | #include <tut/tut.h> | ||
40 | |||
41 | #include "lldate.h" | ||
42 | #include "lluri.h" | ||
43 | |||
44 | class LLSD; | ||
45 | |||
46 | namespace tut | ||
47 | { | ||
48 | template <class T,class Q> | ||
49 | void ensure_not_equals(const char* msg,const Q& actual,const T& expected) | ||
50 | { | ||
51 | if( expected == actual ) | ||
52 | { | ||
53 | std::stringstream ss; | ||
54 | ss << (msg?msg:"") << (msg?": ":"") << "both equal " << expected; | ||
55 | throw tut::failure(ss.str().c_str()); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | template <class T,class Q> | ||
60 | void ensure_not_equals(const Q& actual,const T& expected) | ||
61 | { | ||
62 | ensure_not_equals(NULL, actual, expected); | ||
63 | } | ||
64 | |||
65 | |||
66 | template <class T,class Q> | ||
67 | void ensure_equals(const std::string& msg, | ||
68 | const Q& actual,const T& expected) | ||
69 | { ensure_equals(msg.c_str(), actual, expected); } | ||
70 | |||
71 | template<> | ||
72 | void ensure_equals(const char* msg, | ||
73 | const LLDate& actual, const LLDate& expected); | ||
74 | |||
75 | template<> | ||
76 | void ensure_equals(const char* msg, | ||
77 | const LLURI& actual, const LLURI& expected); | ||
78 | |||
79 | template<> | ||
80 | void ensure_equals(const char* msg, | ||
81 | const std::vector<U8>& actual, const std::vector<U8>& expected); | ||
82 | |||
83 | template<> | ||
84 | void ensure_equals(const char* msg, | ||
85 | const LLSD& actual, const LLSD& expected); | ||
86 | |||
87 | void ensure_starts_with(const std::string& msg, | ||
88 | const std::string& actual, const std::string& expectedStart); | ||
89 | |||
90 | void ensure_contains(const std::string& msg, | ||
91 | const std::string& actual, const std::string& expectedSubString); | ||
92 | } | ||
93 | |||
94 | |||
95 | #endif // LL_LLTUT_H | ||