diff options
author | Charles Krinke | 2008-09-05 23:26:35 +0000 |
---|---|---|
committer | Charles Krinke | 2008-09-05 23:26:35 +0000 |
commit | 947242f4764b8d98fe860d3c18bcea709aea777f (patch) | |
tree | 2169a26250473aa887dac6f492b582e779d41639 /OpenSim/Tests/Region/ScriptEngine/Shared | |
parent | Thank you kindly, KrTaylor for a patch that adds: (diff) | |
download | opensim-SC_OLD-947242f4764b8d98fe860d3c18bcea709aea777f.zip opensim-SC_OLD-947242f4764b8d98fe860d3c18bcea709aea777f.tar.gz opensim-SC_OLD-947242f4764b8d98fe860d3c18bcea709aea777f.tar.bz2 opensim-SC_OLD-947242f4764b8d98fe860d3c18bcea709aea777f.tar.xz |
Mantis#2126. Thank you kindly, Ralphos for a patch that addresses:
Types extracted from a LSL_Types.list have to be down-cast initially
to the exact type of value type object that the Object actually is.
This would make for very cumbersome, ugly code when extracting list
parameter items in ll functions where a few implicit conversions
should be applied such as key -> LSLString and LSLInteger -> LSLFloat
(but not LSLFloat -> LSLInteger). This patch adds a set of GetXXXItem
member functions to the LLS_Type.list class, where XXX is the name
of the LSL_Type to be extracted: LSLFLoat, LSLInteger etc. All take
a single, int parameter that is the item number to be extracted.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Region/ScriptEngine/Shared/LSL_TypesTestList.cs | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/OpenSim/Tests/Region/ScriptEngine/Shared/LSL_TypesTestList.cs b/OpenSim/Tests/Region/ScriptEngine/Shared/LSL_TypesTestList.cs index 9e8d716..ca59c97 100644 --- a/OpenSim/Tests/Region/ScriptEngine/Shared/LSL_TypesTestList.cs +++ b/OpenSim/Tests/Region/ScriptEngine/Shared/LSL_TypesTestList.cs | |||
@@ -157,6 +157,105 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
157 | Assert.AreEqual(testValue, (LSL_Types.Quaternion)testList.Data[0]); | 157 | Assert.AreEqual(testValue, (LSL_Types.Quaternion)testList.Data[0]); |
158 | } | 158 | } |
159 | 159 | ||
160 | //==================================================================================== | ||
160 | 161 | ||
162 | /// <summary> | ||
163 | /// Tests GetLSLIntegerItem for LSLInteger item. | ||
164 | /// </summary> | ||
165 | [Test] | ||
166 | public void TestGetLSLIntegerItemForLSLIntegerItem() | ||
167 | { | ||
168 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(999911); | ||
169 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
170 | |||
171 | Assert.AreEqual(testValue, testList.GetLSLIntegerItem(0)); | ||
172 | } | ||
173 | |||
174 | /// <summary> | ||
175 | /// Tests GetLSLFloatItem for LSLFloat item. | ||
176 | /// </summary> | ||
177 | [Test] | ||
178 | public void TestGetLSLFloatItemForLSLFloatItem() | ||
179 | { | ||
180 | LSL_Types.LSLFloat testValue = new LSL_Types.LSLFloat(321.45687876); | ||
181 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
182 | |||
183 | Assert.AreEqual(testValue, testList.GetLSLFloatItem(0)); | ||
184 | } | ||
185 | |||
186 | /// <summary> | ||
187 | /// Tests GetLSLFloatItem for LSLInteger item. | ||
188 | /// </summary> | ||
189 | [Test] | ||
190 | public void TestGetLSLFloatItemForLSLIntegerItem() | ||
191 | { | ||
192 | LSL_Types.LSLInteger testValue = new LSL_Types.LSLInteger(3060987); | ||
193 | LSL_Types.LSLFloat testFloatValue = new LSL_Types.LSLFloat(testValue); | ||
194 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
195 | |||
196 | Assert.AreEqual(testFloatValue, testList.GetLSLFloatItem(0)); | ||
197 | } | ||
198 | |||
199 | /// <summary> | ||
200 | /// Tests GetLSLStringItem for LSLString item. | ||
201 | /// </summary> | ||
202 | [Test] | ||
203 | public void TestGetLSLStringItemForLSLStringItem() | ||
204 | { | ||
205 | LSL_Types.LSLString testValue = new LSL_Types.LSLString("hello all"); | ||
206 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
207 | |||
208 | Assert.AreEqual(testValue, testList.GetLSLStringItem(0)); | ||
209 | } | ||
210 | |||
211 | /// <summary> | ||
212 | /// Tests GetLSLStringItem for key item. | ||
213 | /// </summary> | ||
214 | [Test] | ||
215 | public void TestGetLSLStringItemForKeyItem() | ||
216 | { | ||
217 | LSL_Types.key testValue | ||
218 | = new LSL_Types.key("98000000-0000-2222-3333-100000001000"); | ||
219 | LSL_Types.LSLString testStringValue = new LSL_Types.LSLString(testValue); | ||
220 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
221 | |||
222 | Assert.AreEqual(testStringValue, testList.GetLSLStringItem(0)); | ||
223 | } | ||
224 | |||
225 | /// <summary> | ||
226 | /// Tests GetVector3Item for Vector3 item. | ||
227 | /// </summary> | ||
228 | [Test] | ||
229 | public void TestGetVector3ItemForVector3Item() | ||
230 | { | ||
231 | LSL_Types.Vector3 testValue = new LSL_Types.Vector3(92.34, 58.98754, -0.10987); | ||
232 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
233 | |||
234 | Assert.AreEqual(testValue, testList.GetVector3Item(0)); | ||
235 | } | ||
236 | /// <summary> | ||
237 | /// Tests GetQuaternionItem for Quaternion item. | ||
238 | /// </summary> | ||
239 | [Test] | ||
240 | public void TestGetQuaternionItemForQuaternionItem() | ||
241 | { | ||
242 | LSL_Types.Quaternion testValue = new LSL_Types.Quaternion(12.64, 59.43723, 765.3421, 4.00987); | ||
243 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
244 | |||
245 | Assert.AreEqual(testValue, testList.GetQuaternionItem(0)); | ||
246 | } | ||
247 | |||
248 | /// <summary> | ||
249 | /// Tests GetKeyItem for key item. | ||
250 | /// </summary> | ||
251 | [Test] | ||
252 | public void TestGetKeyItemForKeyItem() | ||
253 | { | ||
254 | LSL_Types.key testValue | ||
255 | = new LSL_Types.key("00000000-0000-2222-3333-100000001012"); | ||
256 | LSL_Types.list testList = new LSL_Types.list(testValue); | ||
257 | |||
258 | Assert.AreEqual(testValue, testList.GetKeyItem(0)); | ||
259 | } | ||
161 | } | 260 | } |
162 | } | 261 | } |