summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests/llpounceable_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/tests/llpounceable_test.cpp')
-rw-r--r--indra/llcommon/tests/llpounceable_test.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/indra/llcommon/tests/llpounceable_test.cpp b/indra/llcommon/tests/llpounceable_test.cpp
index 1f8cdca145..25458865a6 100644
--- a/indra/llcommon/tests/llpounceable_test.cpp
+++ b/indra/llcommon/tests/llpounceable_test.cpp
@@ -20,6 +20,13 @@
// other Linden headers
#include "../test/lltut.h"
+/*----------------------------- string testing -----------------------------*/
+void append(std::string* dest, const std::string& src)
+{
+ dest->append(src);
+}
+
+/*-------------------------- Data-struct testing ---------------------------*/
struct Data
{
Data(const std::string& data):
@@ -192,6 +199,29 @@ namespace tut
template<> template<>
void object::test<6>()
{
+ set_test_name("queue order");
+ std::string data;
+ LLPounceable<std::string*> pounceable;
+ pounceable.callWhenReady(boost::bind(append, _1, "a"));
+ pounceable.callWhenReady(boost::bind(append, _1, "b"));
+ pounceable.callWhenReady(boost::bind(append, _1, "c"));
+ pounceable = &data;
+ ensure_equals("callWhenReady() must preserve chronological order",
+ data, "abc");
+
+ std::string data2;
+ pounceable = NULL;
+ pounceable.callWhenReady(boost::bind(append, _1, "d"));
+ pounceable.callWhenReady(boost::bind(append, _1, "e"));
+ pounceable.callWhenReady(boost::bind(append, _1, "f"));
+ pounceable = &data2;
+ ensure_equals("LLPounceable must reset queue when fired",
+ data2, "def");
+ }
+
+ template<> template<>
+ void object::test<7>()
+ {
set_test_name("compile-fail test, uncomment to check");
// The following declaration should fail: only LLPounceableQueue and
// LLPounceableStatic should work as tags.