public void LLSDTerseParsing() { string testOne = "[r0.99967899999999998428,r-0.025334599999999998787,r0]"; string testTwo = "[[r1,r1,r1],r0]"; string testThree = "{'region_handle':[r255232, r256512], 'position':[r33.6, r33.71, r43.13], 'look_at':[r34.6, r33.71, r43.13]}"; OSD obj = OSDParser.DeserializeLLSDNotation(testOne); Assert.IsInstanceOf <OSDArray>(obj, "Expected SDArray, got " + obj.GetType().ToString()); OSDArray array = (OSDArray)obj; Assert.IsTrue(array.Count == 3, "Expected three contained objects, got " + array.Count); Assert.IsTrue(array[0].AsReal() > 0.9d && array[0].AsReal() < 1.0d, "Unexpected value for first real " + array[0].AsReal()); Assert.IsTrue(array[1].AsReal() < 0.0d && array[1].AsReal() > -0.03d, "Unexpected value for second real " + array[1].AsReal()); Assert.IsTrue(array[2].AsReal() == 0.0d, "Unexpected value for third real " + array[2].AsReal()); obj = OSDParser.DeserializeLLSDNotation(testTwo); Assert.IsInstanceOf <OSDArray>(obj, "Expected SDArray, got " + obj.GetType().ToString()); array = (OSDArray)obj; Assert.IsTrue(array.Count == 2, "Expected two contained objects, got " + array.Count); Assert.IsTrue(array[1].AsReal() == 0.0d, "Unexpected value for real " + array[1].AsReal()); obj = array[0]; Assert.IsInstanceOf <OSDArray>(obj, "Expected ArrayList, got " + obj.GetType().ToString()); array = (OSDArray)obj; Assert.IsTrue(array[0].AsReal() == 1.0d && array[1].AsReal() == 1.0d && array[2].AsReal() == 1.0d, "Unexpected value(s) for nested array: " + array[0].AsReal() + ", " + array[1].AsReal() + ", " + array[2].AsReal()); obj = OSDParser.DeserializeLLSDNotation(testThree); Assert.IsInstanceOf <OSDMap>(obj, "Expected LLSDMap, got " + obj.GetType().ToString()); OSDMap hashtable = (OSDMap)obj; Assert.IsTrue(hashtable.Count == 3, "Expected three contained objects, got " + hashtable.Count); Assert.IsInstanceOf <OSDArray>(hashtable["region_handle"]); Assert.IsTrue(((OSDArray)hashtable["region_handle"]).Count == 2); Assert.IsInstanceOf <OSDArray>(hashtable["position"]); Assert.IsTrue(((OSDArray)hashtable["position"]).Count == 3); Assert.IsInstanceOf <OSDArray>(hashtable["look_at"]); Assert.IsTrue(((OSDArray)hashtable["look_at"]).Count == 3); }