diff options
author | Oz Linden <oz@lindenlab.com> | 2020-06-15 15:29:04 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2020-06-15 15:29:04 -0400 |
commit | 86009f885efc796850d3e5b612c896a9d737fb86 (patch) | |
tree | 404923800dbc6d09ea72b10de0c7f4bb103d1e62 /indra/test | |
parent | 17598f936bb6b099f21fc32aa80b68258cdfd0b9 (diff) | |
parent | 1702a65665879d0c68df4c6b4fdb60f815ab7abb (diff) |
SL-10297: merge up to master at 6.4.3
Diffstat (limited to 'indra/test')
-rw-r--r-- | indra/test/llsdmessagebuilder_tut.cpp | 2 | ||||
-rw-r--r-- | indra/test/llsdmessagereader_tut.cpp | 2 | ||||
-rw-r--r-- | indra/test/llsdutil_tut.cpp | 45 | ||||
-rw-r--r-- | indra/test/lltemplatemessagebuilder_tut.cpp | 5 |
4 files changed, 50 insertions, 4 deletions
diff --git a/indra/test/llsdmessagebuilder_tut.cpp b/indra/test/llsdmessagebuilder_tut.cpp index b7283f53a6..b65a3fefd5 100644 --- a/indra/test/llsdmessagebuilder_tut.cpp +++ b/indra/test/llsdmessagebuilder_tut.cpp @@ -272,7 +272,7 @@ namespace tut void LLSDMessageBuilderTestObject::test<14>() // Quaternion { - LLQuaternion outValue, inValue = LLQuaternion(1,2,3,4); + LLQuaternion outValue, inValue = LLQuaternion(1,LLVector3(2,3,4)); LLSDMessageBuilder builder = defaultBuilder(); builder.addQuat("var", inValue); LLSDMessageReader reader = setReader(builder); diff --git a/indra/test/llsdmessagereader_tut.cpp b/indra/test/llsdmessagereader_tut.cpp index 6dc5cf593e..3c402765d8 100644 --- a/indra/test/llsdmessagereader_tut.cpp +++ b/indra/test/llsdmessagereader_tut.cpp @@ -274,7 +274,7 @@ namespace tut void LLSDMessageReaderTestObject::test<17>() // Quaternion { - LLQuaternion outValue, inValue = LLQuaternion(1,2,3,4); + LLQuaternion outValue, inValue = LLQuaternion(1,LLVector3(2,3,4)); LLSD sdValue = ll_sd_from_quaternion(inValue); LLSDMessageReader msg = testType(sdValue); msg.getQuat("block", "var", outValue); diff --git a/indra/test/llsdutil_tut.cpp b/indra/test/llsdutil_tut.cpp index 140f4b832b..6fce53f335 100644 --- a/indra/test/llsdutil_tut.cpp +++ b/indra/test/llsdutil_tut.cpp @@ -386,4 +386,49 @@ namespace tut lmap["Seattle"] = 72; ensure("llsd_equals(superset left map)", ! llsd_equals(lmap, rmap)); } + + template<> template<> + void llsdutil_object::test<10>() + { + set_test_name("llsd_hashing"); + + { + LLSD data_s1 = LLSD::String("The quick brown aardvark jumped over the lazy lemming."); + LLSD data_s2 = LLSD::String("The quick brown aardvark jumped over the lazy lemming."); + + ensure("hash: Identical string hashes match.", boost::hash<LLSD>{}(data_s1) == boost::hash<LLSD>{}(data_s2)); + } + { + LLSD data_r1 = LLSD::Real(3.0f); + LLSD data_i1 = LLSD::Integer(3); + ensure("hash: equivalent values but different types do not match.", boost::hash<LLSD>{}(data_r1) != boost::hash<LLSD>{}(data_i1)); + } + { + LLSD data_a1 = LLSDArray("A")("B")("C"); + LLSD data_a2 = LLSDArray("A")("B")("C"); + + ensure("hash: identical arrays produce identical results", boost::hash<LLSD>{}(data_a1) == boost::hash<LLSD>{}(data_a2)); + + data_a2.append(LLSDArray(1)(2)); + + ensure("hash: changing the array changes the hash.", boost::hash<LLSD>{}(data_a1) != boost::hash<LLSD>{}(data_a2)); + + data_a1.append(LLSDArray(1)(2)); + ensure("hash: identical arrays produce identical results with nested arrays", boost::hash<LLSD>{}(data_a1) == boost::hash<LLSD>{}(data_a2)); + } + { + LLSD data_m1 = LLSDMap("key1", LLSD::Real(3.0))("key2", "value2")("key3", LLSDArray(1)(2)(3)); + LLSD data_m2 = LLSDMap("key1", LLSD::Real(3.0))("key2", "value2")("key3", LLSDArray(1)(2)(3)); + + ensure("hash: identical maps produce identical results", boost::hash<LLSD>{}(data_m1) == boost::hash<LLSD>{}(data_m2)); + + LLSD data_m3 = LLSDMap("key1", LLSD::Real(5.0))("key2", "value2")("key3", LLSDArray(1)(2)(3)); + ensure("hash: Different values in the map produce different hashes.", boost::hash<LLSD>{}(data_m1) != boost::hash<LLSD>{}(data_m3)); + + LLSD data_m4 = LLSDMap("keyA", LLSD::Real(3.0))("key2", "value2")("key3", LLSDArray(1)(2)(3)); + ensure("hash: Different keys in the map produce different hashes.", boost::hash<LLSD>{}(data_m1) != boost::hash<LLSD>{}(data_m4)); + + } + } + } diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp index 7b4b6a8b70..10564ad7b3 100644 --- a/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/indra/test/lltemplatemessagebuilder_tut.cpp @@ -319,7 +319,8 @@ namespace tut { LLMessageTemplate messageTemplate = defaultTemplate(); messageTemplate.addBlock(defaultBlock(MVT_LLQuaternion, 12)); - LLQuaternion outValue, inValue = LLQuaternion(0.3713907f, 0.5570861f, 0.7427813f,0.0f); + LLQuaternion outValue, inValue = LLQuaternion(0.0f, LLVector3(0.3713907f, 0.5570861f, 0.7427813f)); + LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); builder->addQuat(_PREHASH_Test0, inValue); LLTemplateMessageReader* reader = setReader(messageTemplate, builder); @@ -786,7 +787,7 @@ namespace tut { LLMessageTemplate messageTemplate = defaultTemplate(); messageTemplate.addBlock(defaultBlock(MVT_LLQuaternion, 12)); - LLQuaternion outValue, inValue = LLQuaternion(0.3713907f, 0.5570861f, 0.7427813f,0.0f); + LLQuaternion outValue, inValue = LLQuaternion(0.0f, LLVector3(0.3713907f, 0.5570861f, 0.7427813f)); LLTemplateMessageBuilder* builder = defaultBuilder(messageTemplate); builder->addQuat(_PREHASH_Test0, inValue); LLTemplateMessageReader* reader = setReader( |