summaryrefslogtreecommitdiff
path: root/indra/test/llsd_new_tut.cpp
diff options
context:
space:
mode:
authorDebi King (Dessie) <dessie@lindenlab.com>2011-12-13 17:36:29 -0500
committerDebi King (Dessie) <dessie@lindenlab.com>2011-12-13 17:36:29 -0500
commite4f1f611a4736e4b0b78c0d61c3c5f576fec93d0 (patch)
tree87aeed34bc9378648e1b8729bacf8462b4d9ec2d /indra/test/llsd_new_tut.cpp
parent20bc02d2544320a5ad99c61b8d012608319e3161 (diff)
parentd8aa31d10a89aa826cc549594c083a054a2ad967 (diff)
merged .hgtags
Diffstat (limited to 'indra/test/llsd_new_tut.cpp')
-rw-r--r--indra/test/llsd_new_tut.cpp71
1 files changed, 58 insertions, 13 deletions
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp
index dd93b36f04..b2fa54a688 100644
--- a/indra/test/llsd_new_tut.cpp
+++ b/indra/test/llsd_new_tut.cpp
@@ -5,7 +5,7 @@
*
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * Copyright (C) 2006-2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -32,6 +32,19 @@
#include "llsdtraits.h"
#include "llstring.h"
+#if LL_WINDOWS
+#include <float.h>
+namespace
+{
+ int fpclassify(double x)
+ {
+ return _fpclass(x);
+ }
+}
+#else
+using std::fpclassify;
+#endif
+
namespace tut
{
class SDCleanupCheck
@@ -218,19 +231,16 @@ namespace tut
}
else
{
-// TODO: Fix on windows....
-#ifndef LL_WINDOWS
-# if !defined(fpclassify) && __GNUC__ >= 3
-# define FPCLASSIFY_NAMESPACE std::
-# else
-# define FPCLASSIFY_NAMESPACE
-# endif
- int left = FPCLASSIFY_NAMESPACE fpclassify(v.asReal());
- int right = FPCLASSIFY_NAMESPACE fpclassify(eReal);
+ int left = fpclassify(v.asReal());
+ int right = fpclassify(eReal);
ensure_equals(s+" to real", left, right);
- ensure_equals(s+" to string", v.asString(), eString);
-#endif
+ // ensure_equals(s+" to string", v.asString(), eString);
+ // I've commented this check out, since there doesn't
+ // seem to be uniform string representation for NaN on
+ // all platforms. For example, on my Ubuntu 8.10 laptop
+ // with libc 2.11.1, sqrt(-1.0) will return '-nan', not
+ // 'nan'.
}
}
@@ -742,6 +752,42 @@ namespace tut
LLSD w = v;
w = "nice day";
}
+
+ {
+ 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();
+ }
}
template<> template<>
@@ -769,4 +815,3 @@ namespace tut
test serializations
*/
}
-