summaryrefslogtreecommitdiff
path: root/indra/test/llsd_new_tut.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/test/llsd_new_tut.cpp')
-rw-r--r--indra/test/llsd_new_tut.cpp74
1 files changed, 36 insertions, 38 deletions
diff --git a/indra/test/llsd_new_tut.cpp b/indra/test/llsd_new_tut.cpp
index b40d4fa348..dd93b36f04 100644
--- a/indra/test/llsd_new_tut.cpp
+++ b/indra/test/llsd_new_tut.cpp
@@ -3,34 +3,29 @@
* @date February 2006
* @brief LLSD unit tests
*
- * $LicenseInfo:firstyear=2006&license=viewergpl$
- *
- * Copyright (c) 2006-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, 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
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-#include <tut/tut.h>
+#include <tut/tut.hpp>
#include "linden_common.h"
#include "lltut.h"
@@ -108,7 +103,7 @@ namespace tut
SDCleanupCheck check;
LLSD v;
-
+
v = true; ensureTypeAndValue("set true", v, true);
v = false; ensureTypeAndValue("set false", v, false);
v = true; ensureTypeAndValue("set true again", v, true);
@@ -132,13 +127,11 @@ namespace tut
v = newUUID; ensureTypeAndValue("set to new UUID", v, newUUID);
v = nullUUID; ensureTypeAndValue("set to null again", v, nullUUID);
- // strings must be tested with three (!) types of string objects
+ // strings must be tested with two types of string objects
std::string s = "now is the time";
- LLString ls = "for all good zorks";
- const char* cs = "to come to the air of their planet";
+ const char* cs = "for all good zorks";
v = s; ensureTypeAndValue("set to std::string", v, s);
- v = ls; ensureTypeAndValue("set to LLString", v, ls);
v = cs; ensureTypeAndValue("set to const char*", v, cs);
LLDate epoch;
@@ -186,10 +179,10 @@ namespace tut
ensureTypeAndValue("construct std::string", ss1, "abc");
LLSD ss2 = std::string("abc");
ensureTypeAndValue("initialize std::string",ss2, "abc");
- LLSD sl1(LLString("def"));
- ensureTypeAndValue("construct LLString", sl1, "def");
- LLSD sl2 = LLString("def");
- ensureTypeAndValue("initialize LLString", sl2, "def");
+ LLSD sl1(std::string("def"));
+ ensureTypeAndValue("construct std::string", sl1, "def");
+ LLSD sl2 = std::string("def");
+ ensureTypeAndValue("initialize std::string", sl2, "def");
LLSD sc1("ghi");
ensureTypeAndValue("construct const char*", sc1, "ghi");
LLSD sc2 = "ghi";
@@ -432,10 +425,6 @@ namespace tut
// SAD s = v; ensure_equals("assign to string", s, " 42.375");
s = (std::string)v; ensure_equals("cast to string", s, " 42.375");
- LLString t = "yo";
-// SAD t = v; ensure_equals("assign to LLString", t, " 42.375");
- t = (LLString)v; ensure_equals("cast to LLString", t, " 42.375");
-
std::string uuidStr = "b1e50c2b-b627-4d23-8a86-a65d97b6319b";
v = uuidStr;
LLUUID u;
@@ -486,10 +475,10 @@ namespace tut
ensure_equals("contruct string", s1, " 42.375");
ensure_equals("initialize string", s2, " 42.375");
- LLString t1(v);
- LLString t2 = v.asString(); // SAD
- ensure_equals("contruct LLString", t1, " 42.375");
- ensure_equals("initialize LLString", t2, " 42.375");
+ std::string t1(v);
+ std::string t2 = v.asString(); // SAD
+ ensure_equals("contruct std::string", t1, " 42.375");
+ ensure_equals("initialize std::string", t2, " 42.375");
std::string uuidStr = "b1e50c2b-b627-4d23-8a86-a65d97b6319b";
v = uuidStr;
@@ -755,6 +744,15 @@ namespace tut
}
}
+ template<> template<>
+ void SDTestObject::test<14>()
+ // make sure that assignment of char* NULL in a string does not crash.
+ {
+ LLSD v;
+ v = (const char*)NULL;
+ ensure("type is a string", v.isString());
+ }
+
/* TO DO:
conversion of undefined to UUID, Date, URI and Binary
conversion of undefined to map and array