aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/lltut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/test/lltut.cpp')
-rw-r--r--linden/indra/test/lltut.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/linden/indra/test/lltut.cpp b/linden/indra/test/lltut.cpp
index 31b83e6..1127f72 100644
--- a/linden/indra/test/lltut.cpp
+++ b/linden/indra/test/lltut.cpp
@@ -27,7 +27,10 @@
27 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 */ 28 */
29 29
30#include "linden_common.h"
30#include "lltut.h" 31#include "lltut.h"
32
33#include "llformat.h"
31#include "llsd.h" 34#include "llsd.h"
32 35
33namespace tut 36namespace tut
@@ -154,6 +157,20 @@ namespace tut
154 } 157 }
155 } 158 }
156 159
160 void ensure_ends_with(const std::string& msg,
161 const std::string& actual, const std::string& expectedEnd)
162 {
163 if( actual.size() < expectedEnd.size()
164 || actual.rfind(expectedEnd)
165 != (actual.size() - expectedEnd.size()) )
166 {
167 std::stringstream ss;
168 ss << msg << ": " << "expected to find " << expectedEnd
169 << " at end of actual " << actual;
170 throw failure(ss.str().c_str());
171 }
172 }
173
157 void ensure_contains(const std::string& msg, 174 void ensure_contains(const std::string& msg,
158 const std::string& actual, const std::string& expectedSubString) 175 const std::string& actual, const std::string& expectedSubString)
159 { 176 {
@@ -165,4 +182,16 @@ namespace tut
165 throw failure(ss.str().c_str()); 182 throw failure(ss.str().c_str());
166 } 183 }
167 } 184 }
185
186 void ensure_does_not_contain(const std::string& msg,
187 const std::string& actual, const std::string& expectedSubString)
188 {
189 if( actual.find(expectedSubString, 0) != std::string::npos )
190 {
191 std::stringstream ss;
192 ss << msg << ": " << "expected not to find " << expectedSubString
193 << " in actual " << actual;
194 throw failure(ss.str().c_str());
195 }
196 }
168} 197}