diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2011-12-01 16:53:28 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2011-12-01 16:53:28 -0500 |
commit | 8cbc54d519f8495deee1b1a0da1e08f647ae0cc1 (patch) | |
tree | f9b5826e7bcd8685d213287b8abdc352417ad24f /indra/test | |
parent | f5a94e0f8196c5c068995090cd57bb27e97aaac9 (diff) | |
parent | 95fb0249e9f43d907608cc5840d1f8c0e49981d0 (diff) |
Automated merge with http://hg.secondlife.com/viewer-development
Diffstat (limited to 'indra/test')
-rw-r--r-- | indra/test/llsd_new_tut.cpp | 45 | ||||
-rw-r--r-- | indra/test/lltut.cpp | 5 |
2 files changed, 46 insertions, 4 deletions
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp index b2fa54a688..f928a1bad0 100644 --- a/indra/test/llsd_new_tut.cpp +++ b/indra/test/llsd_new_tut.cpp @@ -25,6 +25,7 @@ * $/LicenseInfo$ */ +#define LLSD_DEBUG_INFO #include <tut/tut.hpp> #include "linden_common.h" #include "lltut.h" @@ -52,11 +53,11 @@ namespace tut private: U32 mOutstandingAtStart; public: - SDCleanupCheck() : mOutstandingAtStart(LLSD::outstandingCount()) { } + SDCleanupCheck() : mOutstandingAtStart(llsd::outstandingCount()) { } ~SDCleanupCheck() { ensure_equals("SDCleanupCheck", - LLSD::outstandingCount(), mOutstandingAtStart); + llsd::outstandingCount(), mOutstandingAtStart); } }; @@ -70,12 +71,12 @@ namespace tut SDAllocationCheck(const std::string& message, int expectedAllocations) : mMessage(message), mExpectedAllocations(expectedAllocations), - mAllocationAtStart(LLSD::allocationCount()) + mAllocationAtStart(llsd::allocationCount()) { } ~SDAllocationCheck() { ensure_equals(mMessage + " SDAllocationCheck", - LLSD::allocationCount() - mAllocationAtStart, + llsd::allocationCount() - mAllocationAtStart, mExpectedAllocations); } }; @@ -756,6 +757,42 @@ namespace tut { SDAllocationCheck check("shared values test for threaded work", 9); + //U32 start_llsd_count = llsd::outstandingCount(); + + LLSD m = LLSD::emptyMap(); + + m["one"] = 1; + m["two"] = 2; + m["one_copy"] = m["one"]; // 3 (m, "one" and "two") + + m["undef_one"] = LLSD(); + m["undef_two"] = LLSD(); + m["undef_one_copy"] = m["undef_one"]; + + { // Ensure first_array gets freed to avoid counting it + LLSD first_array = LLSD::emptyArray(); + first_array.append(1.0f); + first_array.append(2.0f); + first_array.append(3.0f); // 7 + + m["array"] = first_array; + m["array_clone"] = first_array; + m["array_copy"] = m["array"]; // 7 + } + + m["string_one"] = "string one value"; + m["string_two"] = "string two value"; + m["string_one_copy"] = m["string_one"]; // 9 + + //U32 llsd_object_count = llsd::outstandingCount(); + //std::cout << "Using " << (llsd_object_count - start_llsd_count) << " LLSD objects" << std::endl; + + //m.dumpStats(); + } + + { + SDAllocationCheck check("shared values test for threaded work", 9); + //U32 start_llsd_count = LLSD::outstandingCount(); LLSD m = LLSD::emptyMap(); diff --git a/indra/test/lltut.cpp b/indra/test/lltut.cpp index da7031b52a..c43a8f0c7d 100644 --- a/indra/test/lltut.cpp +++ b/indra/test/lltut.cpp @@ -34,6 +34,7 @@ #include "llformat.h" #include "llsd.h" #include "lluri.h" +#include "stringize.h" namespace tut { @@ -144,6 +145,10 @@ namespace tut } return; } + default: + // should never get here, but compiler produces warning if we + // don't cover this case, and at Linden warnings are fatal. + throw failure(STRINGIZE("invalid type field " << actual.type())); } } |