aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs470
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLString.cs78
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs2
3 files changed, 206 insertions, 344 deletions
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
index 29d0e1c..00bf4f4 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
@@ -39,25 +39,174 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
39 // Used for testing equality of two floats. 39 // Used for testing equality of two floats.
40 private double _lowPrecisionTolerance = 0.000001; 40 private double _lowPrecisionTolerance = 0.000001;
41 41
42 private Dictionary<int, double> m_intDoubleSet;
43 private Dictionary<double, double> m_doubleDoubleSet;
44 private Dictionary<double, int> m_doubleIntSet;
45 private Dictionary<double, int> m_doubleUintSet;
46 private Dictionary<string, double> m_stringDoubleSet;
47 private Dictionary<double, string> m_doubleStringSet;
48 private List<int> m_intList;
49 private List<double> m_doubleList;
50
51 /// <summary>
52 /// Sets up dictionaries and arrays used in the tests.
53 /// </summary>
54 [TestFixtureSetUp]
55 public void SetUpDataSets()
56 {
57 m_intDoubleSet = new Dictionary<int, double>();
58 m_intDoubleSet.Add(2, 2.0);
59 m_intDoubleSet.Add(-2, -2.0);
60 m_intDoubleSet.Add(0, 0.0);
61 m_intDoubleSet.Add(1, 1.0);
62 m_intDoubleSet.Add(-1, -1.0);
63 m_intDoubleSet.Add(999999999, 999999999.0);
64 m_intDoubleSet.Add(-99999999, -99999999.0);
65
66 m_doubleDoubleSet = new Dictionary<double, double>();
67 m_doubleDoubleSet.Add(2.0, 2.0);
68 m_doubleDoubleSet.Add(-2.0, -2.0);
69 m_doubleDoubleSet.Add(0.0, 0.0);
70 m_doubleDoubleSet.Add(1.0, 1.0);
71 m_doubleDoubleSet.Add(-1.0, -1.0);
72 m_doubleDoubleSet.Add(999999999.0, 999999999.0);
73 m_doubleDoubleSet.Add(-99999999.0, -99999999.0);
74 m_doubleDoubleSet.Add(0.5, 0.5);
75 m_doubleDoubleSet.Add(0.0005, 0.0005);
76 m_doubleDoubleSet.Add(0.6805, 0.6805);
77 m_doubleDoubleSet.Add(-0.5, -0.5);
78 m_doubleDoubleSet.Add(-0.0005, -0.0005);
79 m_doubleDoubleSet.Add(-0.6805, -0.6805);
80 m_doubleDoubleSet.Add(548.5, 548.5);
81 m_doubleDoubleSet.Add(2.0005, 2.0005);
82 m_doubleDoubleSet.Add(349485435.6805, 349485435.6805);
83 m_doubleDoubleSet.Add(-548.5, -548.5);
84 m_doubleDoubleSet.Add(-2.0005, -2.0005);
85 m_doubleDoubleSet.Add(-349485435.6805, -349485435.6805);
86
87 m_doubleIntSet = new Dictionary<double, int>();
88 m_doubleIntSet.Add(2.0, 2);
89 m_doubleIntSet.Add(-2.0, -2);
90 m_doubleIntSet.Add(0.0, 0);
91 m_doubleIntSet.Add(1.0, 1);
92 m_doubleIntSet.Add(-1.0, -1);
93 m_doubleIntSet.Add(999999999.0, 999999999);
94 m_doubleIntSet.Add(-99999999.0, -99999999);
95 m_doubleIntSet.Add(0.5, 0);
96 m_doubleIntSet.Add(0.0005, 0);
97 m_doubleIntSet.Add(0.6805, 0);
98 m_doubleIntSet.Add(-0.5, 0);
99 m_doubleIntSet.Add(-0.0005, 0);
100 m_doubleIntSet.Add(-0.6805, 0);
101 m_doubleIntSet.Add(548.5, 548);
102 m_doubleIntSet.Add(2.0005, 2);
103 m_doubleIntSet.Add(349485435.6805, 349485435);
104 m_doubleIntSet.Add(-548.5, -548);
105 m_doubleIntSet.Add(-2.0005, -2);
106 m_doubleIntSet.Add(-349485435.6805, -349485435);
107
108 m_doubleUintSet = new Dictionary<double, int>();
109 m_doubleUintSet.Add(2.0, 2);
110 m_doubleUintSet.Add(-2.0, 2);
111 m_doubleUintSet.Add(0.0, 0);
112 m_doubleUintSet.Add(1.0, 1);
113 m_doubleUintSet.Add(-1.0, 1);
114 m_doubleUintSet.Add(999999999.0, 999999999);
115 m_doubleUintSet.Add(-99999999.0, 99999999);
116 m_doubleUintSet.Add(0.5, 0);
117 m_doubleUintSet.Add(0.0005, 0);
118 m_doubleUintSet.Add(0.6805, 0);
119 m_doubleUintSet.Add(-0.5, 0);
120 m_doubleUintSet.Add(-0.0005, 0);
121 m_doubleUintSet.Add(-0.6805, 0);
122 m_doubleUintSet.Add(548.5, 548);
123 m_doubleUintSet.Add(2.0005, 2);
124 m_doubleUintSet.Add(349485435.6805, 349485435);
125 m_doubleUintSet.Add(-548.5, 548);
126 m_doubleUintSet.Add(-2.0005, 2);
127 m_doubleUintSet.Add(-349485435.6805, 349485435);
128
129 m_stringDoubleSet = new Dictionary<string, double>();
130 m_stringDoubleSet.Add("2", 2.0);
131 m_stringDoubleSet.Add("-2", -2.0);
132 m_stringDoubleSet.Add("1", 1.0);
133 m_stringDoubleSet.Add("-1", -1.0);
134 m_stringDoubleSet.Add("0", 0.0);
135 m_stringDoubleSet.Add("999999999.0", 999999999.0);
136 m_stringDoubleSet.Add("-99999999.0", -99999999.0);
137 m_stringDoubleSet.Add("0.5", 0.5);
138 m_stringDoubleSet.Add("0.0005", 0.0005);
139 m_stringDoubleSet.Add("0.6805", 0.6805);
140 m_stringDoubleSet.Add("-0.5", -0.5);
141 m_stringDoubleSet.Add("-0.0005", -0.0005);
142 m_stringDoubleSet.Add("-0.6805", -0.6805);
143 m_stringDoubleSet.Add("548.5", 548.5);
144 m_stringDoubleSet.Add("2.0005", 2.0005);
145 m_stringDoubleSet.Add("349485435.6805", 349485435.6805);
146 m_stringDoubleSet.Add("-548.5", -548.5);
147 m_stringDoubleSet.Add("-2.0005", -2.0005);
148 m_stringDoubleSet.Add("-349485435.6805", -349485435.6805);
149
150 m_doubleStringSet = new Dictionary<double, string>();
151 m_doubleStringSet.Add(2.0, "2.000000");
152 m_doubleStringSet.Add(-2.0, "-2.000000");
153 m_doubleStringSet.Add(1.0, "1.000000");
154 m_doubleStringSet.Add(-1.0, "-1.000000");
155 m_doubleStringSet.Add(0.0, "0.000000");
156 m_doubleStringSet.Add(999999999.0, "999999999.000000");
157 m_doubleStringSet.Add(-99999999.0, "-99999999.000000");
158 m_doubleStringSet.Add(0.5, "0.500000");
159 m_doubleStringSet.Add(0.0005, "0.000500");
160 m_doubleStringSet.Add(0.6805, "0.680500");
161 m_doubleStringSet.Add(-0.5, "-0.500000");
162 m_doubleStringSet.Add(-0.0005, "-0.000500");
163 m_doubleStringSet.Add(-0.6805, "-0.680500");
164 m_doubleStringSet.Add(548.5, "548.500000");
165 m_doubleStringSet.Add(2.0005, "2.000500");
166 m_doubleStringSet.Add(349485435.6805, "349485435.680500");
167 m_doubleStringSet.Add(-548.5, "-548.500000");
168 m_doubleStringSet.Add(-2.0005, "-2.000500");
169 m_doubleStringSet.Add(-349485435.6805, "-349485435.680500");
170
171 m_doubleList = new List<double>();
172 m_doubleList.Add(2.0);
173 m_doubleList.Add(-2.0);
174 m_doubleList.Add(1.0);
175 m_doubleList.Add(-1.0);
176 m_doubleList.Add(999999999.0);
177 m_doubleList.Add(-99999999.0);
178 m_doubleList.Add(0.5);
179 m_doubleList.Add(0.0005);
180 m_doubleList.Add(0.6805);
181 m_doubleList.Add(-0.5);
182 m_doubleList.Add(-0.0005);
183 m_doubleList.Add(-0.6805);
184 m_doubleList.Add(548.5);
185 m_doubleList.Add(2.0005);
186 m_doubleList.Add(349485435.6805);
187 m_doubleList.Add(-548.5);
188 m_doubleList.Add(-2.0005);
189 m_doubleList.Add(-349485435.6805);
190
191 m_intList = new List<int>();
192 m_intList.Add(2);
193 m_intList.Add(-2);
194 m_intList.Add(0);
195 m_intList.Add(1);
196 m_intList.Add(-1);
197 m_intList.Add(999999999);
198 m_intList.Add(-99999999);
199 }
200
42 /// <summary> 201 /// <summary>
43 /// Tests constructing a LSLFloat from an integer. 202 /// Tests constructing a LSLFloat from an integer.
44 /// </summary> 203 /// </summary>
45 [Test] 204 [Test]
46 public void TestConstructFromInt() 205 public void TestConstructFromInt()
47 { 206 {
48 // The numbers we test for.
49 Dictionary<int, double> numberSet = new Dictionary<int, double>();
50 numberSet.Add(2, 2.0);
51 numberSet.Add(-2, -2.0);
52 numberSet.Add(0, 0.0);
53 numberSet.Add(1, 1.0);
54 numberSet.Add(-1, -1.0);
55 numberSet.Add(999999999, 999999999.0);
56 numberSet.Add(-99999999, -99999999.0);
57
58 LSL_Types.LSLFloat testFloat; 207 LSL_Types.LSLFloat testFloat;
59 208
60 foreach (KeyValuePair<int, double> number in numberSet) 209 foreach (KeyValuePair<int, double> number in m_intDoubleSet)
61 { 210 {
62 testFloat = new LSL_Types.LSLFloat(number.Key); 211 testFloat = new LSL_Types.LSLFloat(number.Key);
63 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); 212 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance));
@@ -70,31 +219,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
70 [Test] 219 [Test]
71 public void TestConstructFromDouble() 220 public void TestConstructFromDouble()
72 { 221 {
73 // The numbers we test for.
74 Dictionary<double, double> numberSet = new Dictionary<double, double>();
75 numberSet.Add(2.0, 2.0);
76 numberSet.Add(-2.0, -2.0);
77 numberSet.Add(0.0, 0.0);
78 numberSet.Add(1.0, 1.0);
79 numberSet.Add(-1.0, -1.0);
80 numberSet.Add(999999999.0, 999999999.0);
81 numberSet.Add(-99999999.0, -99999999.0);
82 numberSet.Add(0.5, 0.5);
83 numberSet.Add(0.0005, 0.0005);
84 numberSet.Add(0.6805, 0.6805);
85 numberSet.Add(-0.5, -0.5);
86 numberSet.Add(-0.0005, -0.0005);
87 numberSet.Add(-0.6805, -0.6805);
88 numberSet.Add(548.5, 548.5);
89 numberSet.Add(2.0005, 2.0005);
90 numberSet.Add(349485435.6805, 349485435.6805);
91 numberSet.Add(-548.5, -548.5);
92 numberSet.Add(-2.0005, -2.0005);
93 numberSet.Add(-349485435.6805, -349485435.6805);
94
95 LSL_Types.LSLFloat testFloat; 222 LSL_Types.LSLFloat testFloat;
96 223
97 foreach (KeyValuePair<double, double> number in numberSet) 224 foreach (KeyValuePair<double, double> number in m_doubleDoubleSet)
98 { 225 {
99 testFloat = new LSL_Types.LSLFloat(number.Key); 226 testFloat = new LSL_Types.LSLFloat(number.Key);
100 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); 227 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance));
@@ -107,31 +234,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
107 [Test] 234 [Test]
108 public void TestImplicitCastLSLFloatToInt() 235 public void TestImplicitCastLSLFloatToInt()
109 { 236 {
110 // The numbers we test for.
111 Dictionary<double, int> numberSet = new Dictionary<double, int>();
112 numberSet.Add(2.0, 2);
113 numberSet.Add(-2.0, -2);
114 numberSet.Add(0.0, 0);
115 numberSet.Add(1.0, 1);
116 numberSet.Add(-1.0, -1);
117 numberSet.Add(999999999.0, 999999999);
118 numberSet.Add(-99999999.0, -99999999);
119 numberSet.Add(0.5, 0);
120 numberSet.Add(0.0005, 0);
121 numberSet.Add(0.6805, 0);
122 numberSet.Add(-0.5, 0);
123 numberSet.Add(-0.0005, 0);
124 numberSet.Add(-0.6805, 0);
125 numberSet.Add(548.5, 548);
126 numberSet.Add(2.0005, 2);
127 numberSet.Add(349485435.6805, 349485435);
128 numberSet.Add(-548.5, -548);
129 numberSet.Add(-2.0005, -2);
130 numberSet.Add(-349485435.6805, -349485435);
131
132 int testNumber; 237 int testNumber;
133 238
134 foreach (KeyValuePair<double, int> number in numberSet) 239 foreach (KeyValuePair<double, int> number in m_doubleIntSet)
135 { 240 {
136 testNumber = new LSL_Types.LSLFloat(number.Key); 241 testNumber = new LSL_Types.LSLFloat(number.Key);
137 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); 242 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value);
@@ -144,31 +249,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
144 [Test] 249 [Test]
145 public void TestImplicitCastLSLFloatToUint() 250 public void TestImplicitCastLSLFloatToUint()
146 { 251 {
147 // The numbers we test for.
148 Dictionary<double, int> numberSet = new Dictionary<double, int>();
149 numberSet.Add(2.0, 2);
150 numberSet.Add(-2.0, 2);
151 numberSet.Add(0.0, 0);
152 numberSet.Add(1.0, 1);
153 numberSet.Add(-1.0, 1);
154 numberSet.Add(999999999.0, 999999999);
155 numberSet.Add(-99999999.0, 99999999);
156 numberSet.Add(0.5, 0);
157 numberSet.Add(0.0005, 0);
158 numberSet.Add(0.6805, 0);
159 numberSet.Add(-0.5, 0);
160 numberSet.Add(-0.0005, 0);
161 numberSet.Add(-0.6805, 0);
162 numberSet.Add(548.5, 548);
163 numberSet.Add(2.0005, 2);
164 numberSet.Add(349485435.6805, 349485435);
165 numberSet.Add(-548.5, 548);
166 numberSet.Add(-2.0005, 2);
167 numberSet.Add(-349485435.6805, 349485435);
168
169 uint testNumber; 252 uint testNumber;
170 253
171 foreach (KeyValuePair<double, int> number in numberSet) 254 foreach (KeyValuePair<double, int> number in m_doubleUintSet)
172 { 255 {
173 testNumber = new LSL_Types.LSLFloat(number.Key); 256 testNumber = new LSL_Types.LSLFloat(number.Key);
174 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); 257 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value);
@@ -181,31 +264,10 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
181 [Test] 264 [Test]
182 public void TestImplicitCastLSLFloatToBooleanTrue() 265 public void TestImplicitCastLSLFloatToBooleanTrue()
183 { 266 {
184 // A bunch of numbers to test with.
185 List<double> numberList = new List<double>();
186 numberList.Add(2.0);
187 numberList.Add(-2.0);
188 numberList.Add(1.0);
189 numberList.Add(-1.0);
190 numberList.Add(999999999.0);
191 numberList.Add(-99999999.0);
192 numberList.Add(0.5);
193 numberList.Add(0.0005);
194 numberList.Add(0.6805);
195 numberList.Add(-0.5);
196 numberList.Add(-0.0005);
197 numberList.Add(-0.6805);
198 numberList.Add(548.5);
199 numberList.Add(2.0005);
200 numberList.Add(349485435.6805);
201 numberList.Add(-548.5);
202 numberList.Add(-2.0005);
203 numberList.Add(-349485435.6805);
204
205 LSL_Types.LSLFloat testFloat; 267 LSL_Types.LSLFloat testFloat;
206 bool testBool; 268 bool testBool;
207 269
208 foreach (double number in numberList) 270 foreach (double number in m_doubleList)
209 { 271 {
210 testFloat = new LSL_Types.LSLFloat(number); 272 testFloat = new LSL_Types.LSLFloat(number);
211 testBool = testFloat; 273 testBool = testFloat;
@@ -232,19 +294,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
232 [Test] 294 [Test]
233 public void TestImplicitCastIntToLSLFloat() 295 public void TestImplicitCastIntToLSLFloat()
234 { 296 {
235 // A bunch of numbers to test with.
236 List<int> numberList = new List<int>();
237 numberList.Add(2);
238 numberList.Add(-2);
239 numberList.Add(0);
240 numberList.Add(1);
241 numberList.Add(-1);
242 numberList.Add(999999999);
243 numberList.Add(-99999999);
244
245 LSL_Types.LSLFloat testFloat; 297 LSL_Types.LSLFloat testFloat;
246 298
247 foreach (int number in numberList) 299 foreach (int number in m_intList)
248 { 300 {
249 testFloat = number; 301 testFloat = number;
250 Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); 302 Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
@@ -257,31 +309,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
257 [Test] 309 [Test]
258 public void TestImplicitCastStringToLSLFloat() 310 public void TestImplicitCastStringToLSLFloat()
259 { 311 {
260 // A bunch of numbers to test with.
261 Dictionary<string, double> numberSet = new Dictionary<string, double>();
262 numberSet.Add("2", 2.0);
263 numberSet.Add("-2", -2.0);
264 numberSet.Add("1", 1.0);
265 numberSet.Add("-1", -1.0);
266 numberSet.Add("0", 0.0);
267 numberSet.Add("999999999.0", 999999999.0);
268 numberSet.Add("-99999999.0", -99999999.0);
269 numberSet.Add("0.5", 0.5);
270 numberSet.Add("0.0005", 0.0005);
271 numberSet.Add("0.6805", 0.6805);
272 numberSet.Add("-0.5", -0.5);
273 numberSet.Add("-0.0005", -0.0005);
274 numberSet.Add("-0.6805", -0.6805);
275 numberSet.Add("548.5", 548.5);
276 numberSet.Add("2.0005", 2.0005);
277 numberSet.Add("349485435.6805", 349485435.6805);
278 numberSet.Add("-548.5", -548.5);
279 numberSet.Add("-2.0005", -2.0005);
280 numberSet.Add("-349485435.6805", -349485435.6805);
281
282 LSL_Types.LSLFloat testFloat; 312 LSL_Types.LSLFloat testFloat;
283 313
284 foreach (KeyValuePair<string, double> number in numberSet) 314 foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
285 { 315 {
286 testFloat = number.Key; 316 testFloat = number.Key;
287 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); 317 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance));
@@ -294,31 +324,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
294 [Test] 324 [Test]
295 public void TestImplicitCastDoubleToLSLFloat() 325 public void TestImplicitCastDoubleToLSLFloat()
296 { 326 {
297 // A bunch of numbers to test with.
298 List<double> numberList = new List<double>();
299 numberList.Add(2.0);
300 numberList.Add(-2.0);
301 numberList.Add(1.0);
302 numberList.Add(-1.0);
303 numberList.Add(0.0);
304 numberList.Add(999999999.0);
305 numberList.Add(-99999999.0);
306 numberList.Add(0.5);
307 numberList.Add(0.0005);
308 numberList.Add(0.6805);
309 numberList.Add(-0.5);
310 numberList.Add(-0.0005);
311 numberList.Add(-0.6805);
312 numberList.Add(548.5);
313 numberList.Add(2.0005);
314 numberList.Add(349485435.6805);
315 numberList.Add(-548.5);
316 numberList.Add(-2.0005);
317 numberList.Add(-349485435.6805);
318
319 LSL_Types.LSLFloat testFloat; 327 LSL_Types.LSLFloat testFloat;
320 328
321 foreach (double number in numberList) 329 foreach (double number in m_doubleList)
322 { 330 {
323 testFloat = number; 331 testFloat = number;
324 Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); 332 Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
@@ -331,31 +339,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
331 [Test] 339 [Test]
332 public void TestEqualsOperator() 340 public void TestEqualsOperator()
333 { 341 {
334 // A bunch of numbers to test with.
335 List<double> numberList = new List<double>();
336 numberList.Add(2.0);
337 numberList.Add(-2.0);
338 numberList.Add(1.0);
339 numberList.Add(-1.0);
340 numberList.Add(0.0);
341 numberList.Add(999999999.0);
342 numberList.Add(-99999999.0);
343 numberList.Add(0.5);
344 numberList.Add(0.0005);
345 numberList.Add(0.6805);
346 numberList.Add(-0.5);
347 numberList.Add(-0.0005);
348 numberList.Add(-0.6805);
349 numberList.Add(548.5);
350 numberList.Add(2.0005);
351 numberList.Add(349485435.6805);
352 numberList.Add(-548.5);
353 numberList.Add(-2.0005);
354 numberList.Add(-349485435.6805);
355
356 LSL_Types.LSLFloat testFloatA, testFloatB; 342 LSL_Types.LSLFloat testFloatA, testFloatB;
357 343
358 foreach (double number in numberList) 344 foreach (double number in m_doubleList)
359 { 345 {
360 testFloatA = new LSL_Types.LSLFloat(number); 346 testFloatA = new LSL_Types.LSLFloat(number);
361 testFloatB = new LSL_Types.LSLFloat(number); 347 testFloatB = new LSL_Types.LSLFloat(number);
@@ -372,31 +358,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
372 [Test] 358 [Test]
373 public void TestNotEqualOperator() 359 public void TestNotEqualOperator()
374 { 360 {
375 // A bunch of numbers to test with.
376 List<double> numberList = new List<double>();
377 numberList.Add(2.0);
378 numberList.Add(-2.0);
379 numberList.Add(1.0);
380 numberList.Add(-1.0);
381 numberList.Add(0.0);
382 numberList.Add(999999999.0);
383 numberList.Add(-99999999.0);
384 numberList.Add(0.5);
385 numberList.Add(0.0005);
386 numberList.Add(0.6805);
387 numberList.Add(-0.5);
388 numberList.Add(-0.0005);
389 numberList.Add(-0.6805);
390 numberList.Add(548.5);
391 numberList.Add(2.0005);
392 numberList.Add(349485435.6805);
393 numberList.Add(-548.5);
394 numberList.Add(-2.0005);
395 numberList.Add(-349485435.6805);
396
397 LSL_Types.LSLFloat testFloatA, testFloatB; 361 LSL_Types.LSLFloat testFloatA, testFloatB;
398 362
399 foreach (double number in numberList) 363 foreach (double number in m_doubleList)
400 { 364 {
401 testFloatA = new LSL_Types.LSLFloat(number); 365 testFloatA = new LSL_Types.LSLFloat(number);
402 testFloatB = new LSL_Types.LSLFloat(number + 1.0); 366 testFloatB = new LSL_Types.LSLFloat(number + 1.0);
@@ -413,32 +377,10 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
413 [Test] 377 [Test]
414 public void TestIncrementOperator() 378 public void TestIncrementOperator()
415 { 379 {
416 // A bunch of numbers to test with.
417 List<double> numberList = new List<double>();
418 numberList.Add(2.0);
419 numberList.Add(-2.0);
420 numberList.Add(1.0);
421 numberList.Add(-1.0);
422 numberList.Add(0.0);
423 numberList.Add(999999999.0);
424 numberList.Add(-99999999.0);
425 numberList.Add(0.5);
426 numberList.Add(0.0005);
427 numberList.Add(0.6805);
428 numberList.Add(-0.5);
429 numberList.Add(-0.0005);
430 numberList.Add(-0.6805);
431 numberList.Add(548.5);
432 numberList.Add(2.0005);
433 numberList.Add(349485435.6805);
434 numberList.Add(-548.5);
435 numberList.Add(-2.0005);
436 numberList.Add(-349485435.6805);
437
438 LSL_Types.LSLFloat testFloat; 380 LSL_Types.LSLFloat testFloat;
439 double testNumber; 381 double testNumber;
440 382
441 foreach (double number in numberList) 383 foreach (double number in m_doubleList)
442 { 384 {
443 testFloat = new LSL_Types.LSLFloat(number); 385 testFloat = new LSL_Types.LSLFloat(number);
444 386
@@ -459,32 +401,10 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
459 [Test] 401 [Test]
460 public void TestDecrementOperator() 402 public void TestDecrementOperator()
461 { 403 {
462 // A bunch of numbers to test with.
463 List<double> numberList = new List<double>();
464 numberList.Add(2.0);
465 numberList.Add(-2.0);
466 numberList.Add(1.0);
467 numberList.Add(-1.0);
468 numberList.Add(0.0);
469 numberList.Add(999999999.0);
470 numberList.Add(-99999999.0);
471 numberList.Add(0.5);
472 numberList.Add(0.0005);
473 numberList.Add(0.6805);
474 numberList.Add(-0.5);
475 numberList.Add(-0.0005);
476 numberList.Add(-0.6805);
477 numberList.Add(548.5);
478 numberList.Add(2.0005);
479 numberList.Add(349485435.6805);
480 numberList.Add(-548.5);
481 numberList.Add(-2.0005);
482 numberList.Add(-349485435.6805);
483
484 LSL_Types.LSLFloat testFloat; 404 LSL_Types.LSLFloat testFloat;
485 double testNumber; 405 double testNumber;
486 406
487 foreach (double number in numberList) 407 foreach (double number in m_doubleList)
488 { 408 {
489 testFloat = new LSL_Types.LSLFloat(number); 409 testFloat = new LSL_Types.LSLFloat(number);
490 410
@@ -505,32 +425,10 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
505 [Test] 425 [Test]
506 public void TestImplicitCastLSLFloatToDouble() 426 public void TestImplicitCastLSLFloatToDouble()
507 { 427 {
508 // A bunch of numbers to test with.
509 List<double> numberList = new List<double>();
510 numberList.Add(2.0);
511 numberList.Add(-2.0);
512 numberList.Add(1.0);
513 numberList.Add(-1.0);
514 numberList.Add(0.0);
515 numberList.Add(999999999.0);
516 numberList.Add(-99999999.0);
517 numberList.Add(0.5);
518 numberList.Add(0.0005);
519 numberList.Add(0.6805);
520 numberList.Add(-0.5);
521 numberList.Add(-0.0005);
522 numberList.Add(-0.6805);
523 numberList.Add(548.5);
524 numberList.Add(2.0005);
525 numberList.Add(349485435.6805);
526 numberList.Add(-548.5);
527 numberList.Add(-2.0005);
528 numberList.Add(-349485435.6805);
529
530 double testNumber; 428 double testNumber;
531 LSL_Types.LSLFloat testFloat; 429 LSL_Types.LSLFloat testFloat;
532 430
533 foreach (double number in numberList) 431 foreach (double number in m_doubleList)
534 { 432 {
535 testFloat = new LSL_Types.LSLFloat(number); 433 testFloat = new LSL_Types.LSLFloat(number);
536 testNumber = testFloat; 434 testNumber = testFloat;
@@ -545,31 +443,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
545 [Test] 443 [Test]
546 public void TestToString() 444 public void TestToString()
547 { 445 {
548 // A bunch of numbers to test with.
549 Dictionary<double, string> numberSet = new Dictionary<double, string>();
550 numberSet.Add(2.0, "2.000000");
551 numberSet.Add(-2.0, "-2.000000");
552 numberSet.Add(1.0, "1.000000");
553 numberSet.Add(-1.0, "-1.000000");
554 numberSet.Add(0.0, "0.000000");
555 numberSet.Add(999999999.0, "999999999.000000");
556 numberSet.Add(-99999999.0, "-99999999.000000");
557 numberSet.Add(0.5, "0.500000");
558 numberSet.Add(0.0005, "0.000500");
559 numberSet.Add(0.6805, "0.680500");
560 numberSet.Add(-0.5, "-0.500000");
561 numberSet.Add(-0.0005, "-0.000500");
562 numberSet.Add(-0.6805, "-0.680500");
563 numberSet.Add(548.5, "548.500000");
564 numberSet.Add(2.0005, "2.000500");
565 numberSet.Add(349485435.6805, "349485435.680500");
566 numberSet.Add(-548.5, "-548.500000");
567 numberSet.Add(-2.0005, "-2.000500");
568 numberSet.Add(-349485435.6805, "-349485435.680500");
569
570 LSL_Types.LSLFloat testFloat; 446 LSL_Types.LSLFloat testFloat;
571 447
572 foreach (KeyValuePair<double, string> number in numberSet) 448 foreach (KeyValuePair<double, string> number in m_doubleStringSet)
573 { 449 {
574 testFloat = new LSL_Types.LSLFloat(number.Key); 450 testFloat = new LSL_Types.LSLFloat(number.Key);
575 Assert.AreEqual(number.Value, testFloat.ToString()); 451 Assert.AreEqual(number.Value, testFloat.ToString());
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLString.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLString.cs
index 0bba14c..c855f34 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLString.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLString.cs
@@ -35,37 +35,45 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
35 [TestFixture] 35 [TestFixture]
36 public class LSL_TypesTestLSLString 36 public class LSL_TypesTestLSLString
37 { 37 {
38 private Dictionary<double, string> m_doubleStringSet;
39
40 /// <summary>
41 /// Sets up dictionaries and arrays used in the tests.
42 /// </summary>
43 [TestFixtureSetUp]
44 public void SetUpDataSets()
45 {
46 m_doubleStringSet = new Dictionary<double, string>();
47 m_doubleStringSet.Add(2, "2.000000");
48 m_doubleStringSet.Add(-2, "-2.000000");
49 m_doubleStringSet.Add(0, "0.000000");
50 m_doubleStringSet.Add(1, "1.000000");
51 m_doubleStringSet.Add(-1, "-1.000000");
52 m_doubleStringSet.Add(999999999, "999999999.000000");
53 m_doubleStringSet.Add(-99999999, "-99999999.000000");
54 m_doubleStringSet.Add(0.5, "0.500000");
55 m_doubleStringSet.Add(0.0005, "0.000500");
56 m_doubleStringSet.Add(0.6805, "0.680500");
57 m_doubleStringSet.Add(-0.5, "-0.500000");
58 m_doubleStringSet.Add(-0.0005, "-0.000500");
59 m_doubleStringSet.Add(-0.6805, "-0.680500");
60 m_doubleStringSet.Add(548.5, "548.500000");
61 m_doubleStringSet.Add(2.0005, "2.000500");
62 m_doubleStringSet.Add(349485435.6805, "349485435.680500");
63 m_doubleStringSet.Add(-548.5, "-548.500000");
64 m_doubleStringSet.Add(-2.0005, "-2.000500");
65 m_doubleStringSet.Add(-349485435.6805, "-349485435.680500");
66 }
67
38 /// <summary> 68 /// <summary>
39 /// Tests constructing a LSLString from an LSLFloat. 69 /// Tests constructing a LSLString from an LSLFloat.
40 /// </summary> 70 /// </summary>
41 [Test] 71 [Test]
42 public void TestConstructFromLSLFloat() 72 public void TestConstructFromLSLFloat()
43 { 73 {
44 // The numbers we test for.
45 Dictionary<double, string> numberSet = new Dictionary<double, string>();
46 numberSet.Add(2, "2.000000");
47 numberSet.Add(-2, "-2.000000");
48 numberSet.Add(0, "0.000000");
49 numberSet.Add(1, "1.000000");
50 numberSet.Add(-1, "-1.000000");
51 numberSet.Add(999999999, "999999999.000000");
52 numberSet.Add(-99999999, "-99999999.000000");
53 numberSet.Add(0.5, "0.500000");
54 numberSet.Add(0.0005, "0.000500");
55 numberSet.Add(0.6805, "0.680500");
56 numberSet.Add(-0.5, "-0.500000");
57 numberSet.Add(-0.0005, "-0.000500");
58 numberSet.Add(-0.6805, "-0.680500");
59 numberSet.Add(548.5, "548.500000");
60 numberSet.Add(2.0005, "2.000500");
61 numberSet.Add(349485435.6805, "349485435.680500");
62 numberSet.Add(-548.5, "-548.500000");
63 numberSet.Add(-2.0005, "-2.000500");
64 numberSet.Add(-349485435.6805, "-349485435.680500");
65
66 LSL_Types.LSLString testString; 74 LSL_Types.LSLString testString;
67 75
68 foreach (KeyValuePair<double, string> number in numberSet) 76 foreach (KeyValuePair<double, string> number in m_doubleStringSet)
69 { 77 {
70 testString = new LSL_Types.LSLString(new LSL_Types.LSLFloat(number.Key)); 78 testString = new LSL_Types.LSLString(new LSL_Types.LSLFloat(number.Key));
71 Assert.AreEqual(number.Value, testString.m_string); 79 Assert.AreEqual(number.Value, testString.m_string);
@@ -78,31 +86,9 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
78 [Test] 86 [Test]
79 public void TestExplicitCastLSLFloatToLSLString() 87 public void TestExplicitCastLSLFloatToLSLString()
80 { 88 {
81 // The numbers we test for.
82 Dictionary<double, string> numberSet = new Dictionary<double, string>();
83 numberSet.Add(2, "2.000000");
84 numberSet.Add(-2, "-2.000000");
85 numberSet.Add(0, "0.000000");
86 numberSet.Add(1, "1.000000");
87 numberSet.Add(-1, "-1.000000");
88 numberSet.Add(999999999, "999999999.000000");
89 numberSet.Add(-99999999, "-99999999.000000");
90 numberSet.Add(0.5, "0.500000");
91 numberSet.Add(0.0005, "0.000500");
92 numberSet.Add(0.6805, "0.680500");
93 numberSet.Add(-0.5, "-0.500000");
94 numberSet.Add(-0.0005, "-0.000500");
95 numberSet.Add(-0.6805, "-0.680500");
96 numberSet.Add(548.5, "548.500000");
97 numberSet.Add(2.0005, "2.000500");
98 numberSet.Add(349485435.6805, "349485435.680500");
99 numberSet.Add(-548.5, "-548.500000");
100 numberSet.Add(-2.0005, "-2.000500");
101 numberSet.Add(-349485435.6805, "-349485435.680500");
102
103 LSL_Types.LSLString testString; 89 LSL_Types.LSLString testString;
104 90
105 foreach (KeyValuePair<double, string> number in numberSet) 91 foreach (KeyValuePair<double, string> number in m_doubleStringSet)
106 { 92 {
107 testString = (LSL_Types.LSLString) new LSL_Types.LSLFloat(number.Key); 93 testString = (LSL_Types.LSLString) new LSL_Types.LSLFloat(number.Key);
108 Assert.AreEqual(number.Value, testString.m_string); 94 Assert.AreEqual(number.Value, testString.m_string);
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs
index df07190..e63200e 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestList.cs
@@ -79,7 +79,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Tests concatenating an integer to a list. 82 /// Tests concatenating a double to a list.
83 /// </summary> 83 /// </summary>
84 [Test] 84 [Test]
85 public void TestConcatenateDouble() 85 public void TestConcatenateDouble()