aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorMike Mazur2008-07-31 00:29:19 +0000
committerMike Mazur2008-07-31 00:29:19 +0000
commit1c8f4905735ff7653313f725fea13bf6346d1389 (patch)
tree4fb37932b1dc8da15adc1d13ea802f0396f3a513 /OpenSim/Tests
parentThank you, HomerHorwitz, for a patch that (diff)
downloadopensim-SC-1c8f4905735ff7653313f725fea13bf6346d1389.zip
opensim-SC-1c8f4905735ff7653313f725fea13bf6346d1389.tar.gz
opensim-SC-1c8f4905735ff7653313f725fea13bf6346d1389.tar.bz2
opensim-SC-1c8f4905735ff7653313f725fea13bf6346d1389.tar.xz
More LSL_Types implicit/explicit cast changes. Fix issue 1854.
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs54
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs54
2 files changed, 54 insertions, 54 deletions
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
index c2d2a5a..58ca8dd 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs
@@ -228,31 +228,31 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
228 } 228 }
229 229
230 /// <summary> 230 /// <summary>
231 /// Tests LSLFloat is correctly cast implicitly to integer. 231 /// Tests LSLFloat is correctly cast explicitly to integer.
232 /// </summary> 232 /// </summary>
233 [Test] 233 [Test]
234 public void TestImplicitCastLSLFloatToInt() 234 public void TestExplicitCastLSLFloatToInt()
235 { 235 {
236 int testNumber; 236 int testNumber;
237 237
238 foreach (KeyValuePair<double, int> number in m_doubleIntSet) 238 foreach (KeyValuePair<double, int> number in m_doubleIntSet)
239 { 239 {
240 testNumber = new LSL_Types.LSLFloat(number.Key); 240 testNumber = (int) new LSL_Types.LSLFloat(number.Key);
241 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); 241 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value);
242 } 242 }
243 } 243 }
244 244
245 /// <summary> 245 /// <summary>
246 /// Tests LSLFloat is correctly cast implicitly to unsigned integer. 246 /// Tests LSLFloat is correctly cast explicitly to unsigned integer.
247 /// </summary> 247 /// </summary>
248 [Test] 248 [Test]
249 public void TestImplicitCastLSLFloatToUint() 249 public void TestExplicitCastLSLFloatToUint()
250 { 250 {
251 uint testNumber; 251 uint testNumber;
252 252
253 foreach (KeyValuePair<double, int> number in m_doubleUintSet) 253 foreach (KeyValuePair<double, int> number in m_doubleUintSet)
254 { 254 {
255 testNumber = new LSL_Types.LSLFloat(number.Key); 255 testNumber = (uint) new LSL_Types.LSLFloat(number.Key);
256 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); 256 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value);
257 } 257 }
258 } 258 }
@@ -333,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
333 } 333 }
334 334
335 /// <summary> 335 /// <summary>
336 /// Tests string is correctly cast implicitly to LSLFloat. 336 /// Tests string is correctly cast explicitly to LSLFloat.
337 /// </summary> 337 /// </summary>
338 [Test] 338 [Test]
339 public void TestImplicitCastStringToLSLFloat() 339 public void TestExplicitCastStringToLSLFloat()
340 { 340 {
341 LSL_Types.LSLFloat testFloat; 341 LSL_Types.LSLFloat testFloat;
342 342
343 foreach (KeyValuePair<string, double> number in m_stringDoubleSet) 343 foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
344 { 344 {
345 testFloat = number.Key; 345 testFloat = (LSL_Types.LSLFloat) number.Key;
346 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); 346 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance));
347 } 347 }
348 } 348 }
@@ -378,6 +378,24 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
378 } 378 }
379 379
380 /// <summary> 380 /// <summary>
381 /// Tests LSLFloat is correctly cast implicitly to double.
382 /// </summary>
383 [Test]
384 public void TestImplicitCastLSLFloatToDouble()
385 {
386 double testNumber;
387 LSL_Types.LSLFloat testFloat;
388
389 foreach (double number in m_doubleList)
390 {
391 testFloat = new LSL_Types.LSLFloat(number);
392 testNumber = testFloat;
393
394 Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
395 }
396 }
397
398 /// <summary>
381 /// Tests the equality (==) operator. 399 /// Tests the equality (==) operator.
382 /// </summary> 400 /// </summary>
383 [Test] 401 [Test]
@@ -464,24 +482,6 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
464 } 482 }
465 483
466 /// <summary> 484 /// <summary>
467 /// Tests LSLFloat is correctly cast implicitly to double.
468 /// </summary>
469 [Test]
470 public void TestImplicitCastLSLFloatToDouble()
471 {
472 double testNumber;
473 LSL_Types.LSLFloat testFloat;
474
475 foreach (double number in m_doubleList)
476 {
477 testFloat = new LSL_Types.LSLFloat(number);
478 testNumber = testFloat;
479
480 Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
481 }
482 }
483
484 /// <summary>
485 /// Tests LSLFloat.ToString(). 485 /// Tests LSLFloat.ToString().
486 /// </summary> 486 /// </summary>
487 [Test] 487 [Test]
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs
index 035208b..d55f0e3 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs
@@ -228,31 +228,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
228 } 228 }
229 229
230 /// <summary> 230 /// <summary>
231 /// Tests LSLFloat is correctly cast implicitly to integer. 231 /// Tests LSLFloat is correctly cast explicitly to integer.
232 /// </summary> 232 /// </summary>
233 [Test] 233 [Test]
234 public void TestImplicitCastLSLFloatToInt() 234 public void TestExplicitCastLSLFloatToInt()
235 { 235 {
236 int testNumber; 236 int testNumber;
237 237
238 foreach (KeyValuePair<double, int> number in m_doubleIntSet) 238 foreach (KeyValuePair<double, int> number in m_doubleIntSet)
239 { 239 {
240 testNumber = new LSL_Types.LSLFloat(number.Key); 240 testNumber = (int) new LSL_Types.LSLFloat(number.Key);
241 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); 241 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value);
242 } 242 }
243 } 243 }
244 244
245 /// <summary> 245 /// <summary>
246 /// Tests LSLFloat is correctly cast implicitly to unsigned integer. 246 /// Tests LSLFloat is correctly cast explicitly to unsigned integer.
247 /// </summary> 247 /// </summary>
248 [Test] 248 [Test]
249 public void TestImplicitCastLSLFloatToUint() 249 public void TestExplicitCastLSLFloatToUint()
250 { 250 {
251 uint testNumber; 251 uint testNumber;
252 252
253 foreach (KeyValuePair<double, int> number in m_doubleUintSet) 253 foreach (KeyValuePair<double, int> number in m_doubleUintSet)
254 { 254 {
255 testNumber = new LSL_Types.LSLFloat(number.Key); 255 testNumber = (uint) new LSL_Types.LSLFloat(number.Key);
256 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); 256 Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value);
257 } 257 }
258 } 258 }
@@ -333,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
333 } 333 }
334 334
335 /// <summary> 335 /// <summary>
336 /// Tests string is correctly cast implicitly to LSLFloat. 336 /// Tests string is correctly cast explicitly to LSLFloat.
337 /// </summary> 337 /// </summary>
338 [Test] 338 [Test]
339 public void TestImplicitCastStringToLSLFloat() 339 public void TestExplicitCastStringToLSLFloat()
340 { 340 {
341 LSL_Types.LSLFloat testFloat; 341 LSL_Types.LSLFloat testFloat;
342 342
343 foreach (KeyValuePair<string, double> number in m_stringDoubleSet) 343 foreach (KeyValuePair<string, double> number in m_stringDoubleSet)
344 { 344 {
345 testFloat = number.Key; 345 testFloat = (LSL_Types.LSLFloat) number.Key;
346 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); 346 Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance));
347 } 347 }
348 } 348 }
@@ -378,6 +378,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
378 } 378 }
379 379
380 /// <summary> 380 /// <summary>
381 /// Tests LSLFloat is correctly cast implicitly to double.
382 /// </summary>
383 [Test]
384 public void TestImplicitCastLSLFloatToDouble()
385 {
386 double testNumber;
387 LSL_Types.LSLFloat testFloat;
388
389 foreach (double number in m_doubleList)
390 {
391 testFloat = new LSL_Types.LSLFloat(number);
392 testNumber = testFloat;
393
394 Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
395 }
396 }
397
398 /// <summary>
381 /// Tests the equality (==) operator. 399 /// Tests the equality (==) operator.
382 /// </summary> 400 /// </summary>
383 [Test] 401 [Test]
@@ -464,24 +482,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
464 } 482 }
465 483
466 /// <summary> 484 /// <summary>
467 /// Tests LSLFloat is correctly cast implicitly to double.
468 /// </summary>
469 [Test]
470 public void TestImplicitCastLSLFloatToDouble()
471 {
472 double testNumber;
473 LSL_Types.LSLFloat testFloat;
474
475 foreach (double number in m_doubleList)
476 {
477 testFloat = new LSL_Types.LSLFloat(number);
478 testNumber = testFloat;
479
480 Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance));
481 }
482 }
483
484 /// <summary>
485 /// Tests LSLFloat.ToString(). 485 /// Tests LSLFloat.ToString().
486 /// </summary> 486 /// </summary>
487 [Test] 487 [Test]