diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs | 74 |
1 files changed, 61 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs index 10b52cf..3ed2562 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_TypesTestLSLFloat.cs | |||
@@ -213,6 +213,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
213 | [Test] | 213 | [Test] |
214 | public void TestConstructFromInt() | 214 | public void TestConstructFromInt() |
215 | { | 215 | { |
216 | TestHelpers.InMethod(); | ||
217 | |||
216 | LSL_Types.LSLFloat testFloat; | 218 | LSL_Types.LSLFloat testFloat; |
217 | 219 | ||
218 | foreach (KeyValuePair<int, double> number in m_intDoubleSet) | 220 | foreach (KeyValuePair<int, double> number in m_intDoubleSet) |
@@ -228,6 +230,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
228 | [Test] | 230 | [Test] |
229 | public void TestConstructFromDouble() | 231 | public void TestConstructFromDouble() |
230 | { | 232 | { |
233 | TestHelpers.InMethod(); | ||
234 | |||
231 | LSL_Types.LSLFloat testFloat; | 235 | LSL_Types.LSLFloat testFloat; |
232 | 236 | ||
233 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 237 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -243,6 +247,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
243 | [Test] | 247 | [Test] |
244 | public void TestExplicitCastLSLFloatToInt() | 248 | public void TestExplicitCastLSLFloatToInt() |
245 | { | 249 | { |
250 | TestHelpers.InMethod(); | ||
251 | |||
246 | int testNumber; | 252 | int testNumber; |
247 | 253 | ||
248 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) | 254 | foreach (KeyValuePair<double, int> number in m_doubleIntSet) |
@@ -258,6 +264,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
258 | [Test] | 264 | [Test] |
259 | public void TestExplicitCastLSLFloatToUint() | 265 | public void TestExplicitCastLSLFloatToUint() |
260 | { | 266 | { |
267 | TestHelpers.InMethod(); | ||
268 | |||
261 | uint testNumber; | 269 | uint testNumber; |
262 | 270 | ||
263 | foreach (KeyValuePair<double, int> number in m_doubleUintSet) | 271 | foreach (KeyValuePair<double, int> number in m_doubleUintSet) |
@@ -273,6 +281,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
273 | [Test] | 281 | [Test] |
274 | public void TestImplicitCastLSLFloatToBooleanTrue() | 282 | public void TestImplicitCastLSLFloatToBooleanTrue() |
275 | { | 283 | { |
284 | TestHelpers.InMethod(); | ||
285 | |||
276 | LSL_Types.LSLFloat testFloat; | 286 | LSL_Types.LSLFloat testFloat; |
277 | bool testBool; | 287 | bool testBool; |
278 | 288 | ||
@@ -291,6 +301,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
291 | [Test] | 301 | [Test] |
292 | public void TestImplicitCastLSLFloatToBooleanFalse() | 302 | public void TestImplicitCastLSLFloatToBooleanFalse() |
293 | { | 303 | { |
304 | TestHelpers.InMethod(); | ||
305 | |||
294 | LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); | 306 | LSL_Types.LSLFloat testFloat = new LSL_Types.LSLFloat(0.0); |
295 | bool testBool = testFloat; | 307 | bool testBool = testFloat; |
296 | 308 | ||
@@ -303,6 +315,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
303 | [Test] | 315 | [Test] |
304 | public void TestImplicitCastIntToLSLFloat() | 316 | public void TestImplicitCastIntToLSLFloat() |
305 | { | 317 | { |
318 | TestHelpers.InMethod(); | ||
319 | |||
306 | LSL_Types.LSLFloat testFloat; | 320 | LSL_Types.LSLFloat testFloat; |
307 | 321 | ||
308 | foreach (int number in m_intList) | 322 | foreach (int number in m_intList) |
@@ -318,6 +332,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
318 | [Test] | 332 | [Test] |
319 | public void TestImplicitCastLSLIntegerToLSLFloat() | 333 | public void TestImplicitCastLSLIntegerToLSLFloat() |
320 | { | 334 | { |
335 | TestHelpers.InMethod(); | ||
336 | |||
321 | LSL_Types.LSLFloat testFloat; | 337 | LSL_Types.LSLFloat testFloat; |
322 | 338 | ||
323 | foreach (int number in m_intList) | 339 | foreach (int number in m_intList) |
@@ -333,6 +349,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
333 | [Test] | 349 | [Test] |
334 | public void TestExplicitCastLSLIntegerToLSLFloat() | 350 | public void TestExplicitCastLSLIntegerToLSLFloat() |
335 | { | 351 | { |
352 | TestHelpers.InMethod(); | ||
353 | |||
336 | LSL_Types.LSLFloat testFloat; | 354 | LSL_Types.LSLFloat testFloat; |
337 | 355 | ||
338 | foreach (int number in m_intList) | 356 | foreach (int number in m_intList) |
@@ -348,6 +366,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
348 | [Test] | 366 | [Test] |
349 | public void TestExplicitCastStringToLSLFloat() | 367 | public void TestExplicitCastStringToLSLFloat() |
350 | { | 368 | { |
369 | TestHelpers.InMethod(); | ||
370 | |||
351 | LSL_Types.LSLFloat testFloat; | 371 | LSL_Types.LSLFloat testFloat; |
352 | 372 | ||
353 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) | 373 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) |
@@ -363,6 +383,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
363 | [Test] | 383 | [Test] |
364 | public void TestExplicitCastLSLStringToLSLFloat() | 384 | public void TestExplicitCastLSLStringToLSLFloat() |
365 | { | 385 | { |
386 | TestHelpers.InMethod(); | ||
387 | |||
366 | LSL_Types.LSLFloat testFloat; | 388 | LSL_Types.LSLFloat testFloat; |
367 | 389 | ||
368 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) | 390 | foreach (KeyValuePair<string, double> number in m_stringDoubleSet) |
@@ -378,6 +400,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
378 | [Test] | 400 | [Test] |
379 | public void TestImplicitCastDoubleToLSLFloat() | 401 | public void TestImplicitCastDoubleToLSLFloat() |
380 | { | 402 | { |
403 | TestHelpers.InMethod(); | ||
404 | |||
381 | LSL_Types.LSLFloat testFloat; | 405 | LSL_Types.LSLFloat testFloat; |
382 | 406 | ||
383 | foreach (double number in m_doubleList) | 407 | foreach (double number in m_doubleList) |
@@ -393,6 +417,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
393 | [Test] | 417 | [Test] |
394 | public void TestImplicitCastLSLFloatToDouble() | 418 | public void TestImplicitCastLSLFloatToDouble() |
395 | { | 419 | { |
420 | TestHelpers.InMethod(); | ||
421 | |||
396 | double testNumber; | 422 | double testNumber; |
397 | LSL_Types.LSLFloat testFloat; | 423 | LSL_Types.LSLFloat testFloat; |
398 | 424 | ||
@@ -411,19 +437,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
411 | [Test] | 437 | [Test] |
412 | public void TestExplicitCastLSLFloatToFloat() | 438 | public void TestExplicitCastLSLFloatToFloat() |
413 | { | 439 | { |
414 | float testFloat; | 440 | TestHelpers.InMethod(); |
415 | float numberAsFloat; | 441 | |
416 | LSL_Types.LSLFloat testLSLFloat; | 442 | float testFloat; |
417 | foreach (double number in m_doubleList) | 443 | float numberAsFloat; |
418 | { | 444 | LSL_Types.LSLFloat testLSLFloat; |
419 | testLSLFloat = new LSL_Types.LSLFloat(number); | ||
420 | numberAsFloat = (float)number; | ||
421 | testFloat = (float)testLSLFloat; | ||
422 | |||
423 | Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); | ||
424 | } | ||
425 | } | ||
426 | 445 | ||
446 | foreach (double number in m_doubleList) | ||
447 | { | ||
448 | testLSLFloat = new LSL_Types.LSLFloat(number); | ||
449 | numberAsFloat = (float)number; | ||
450 | testFloat = (float)testLSLFloat; | ||
451 | |||
452 | Assert.That((double)testFloat, new DoubleToleranceConstraint((double)numberAsFloat, _lowPrecisionTolerance)); | ||
453 | } | ||
454 | } | ||
427 | 455 | ||
428 | /// <summary> | 456 | /// <summary> |
429 | /// Tests the equality (==) operator. | 457 | /// Tests the equality (==) operator. |
@@ -431,6 +459,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
431 | [Test] | 459 | [Test] |
432 | public void TestEqualsOperator() | 460 | public void TestEqualsOperator() |
433 | { | 461 | { |
462 | TestHelpers.InMethod(); | ||
463 | |||
434 | LSL_Types.LSLFloat testFloatA, testFloatB; | 464 | LSL_Types.LSLFloat testFloatA, testFloatB; |
435 | 465 | ||
436 | foreach (double number in m_doubleList) | 466 | foreach (double number in m_doubleList) |
@@ -450,6 +480,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
450 | [Test] | 480 | [Test] |
451 | public void TestNotEqualOperator() | 481 | public void TestNotEqualOperator() |
452 | { | 482 | { |
483 | TestHelpers.InMethod(); | ||
484 | |||
453 | LSL_Types.LSLFloat testFloatA, testFloatB; | 485 | LSL_Types.LSLFloat testFloatA, testFloatB; |
454 | 486 | ||
455 | foreach (double number in m_doubleList) | 487 | foreach (double number in m_doubleList) |
@@ -469,6 +501,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
469 | [Test] | 501 | [Test] |
470 | public void TestIncrementOperator() | 502 | public void TestIncrementOperator() |
471 | { | 503 | { |
504 | TestHelpers.InMethod(); | ||
505 | |||
472 | LSL_Types.LSLFloat testFloat; | 506 | LSL_Types.LSLFloat testFloat; |
473 | double testNumber; | 507 | double testNumber; |
474 | 508 | ||
@@ -493,6 +527,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
493 | [Test] | 527 | [Test] |
494 | public void TestDecrementOperator() | 528 | public void TestDecrementOperator() |
495 | { | 529 | { |
530 | TestHelpers.InMethod(); | ||
531 | |||
496 | LSL_Types.LSLFloat testFloat; | 532 | LSL_Types.LSLFloat testFloat; |
497 | double testNumber; | 533 | double testNumber; |
498 | 534 | ||
@@ -517,6 +553,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
517 | [Test] | 553 | [Test] |
518 | public void TestToString() | 554 | public void TestToString() |
519 | { | 555 | { |
556 | TestHelpers.InMethod(); | ||
557 | |||
520 | LSL_Types.LSLFloat testFloat; | 558 | LSL_Types.LSLFloat testFloat; |
521 | 559 | ||
522 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) | 560 | foreach (KeyValuePair<double, string> number in m_doubleStringSet) |
@@ -532,6 +570,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
532 | [Test] | 570 | [Test] |
533 | public void TestAddTwoLSLFloats() | 571 | public void TestAddTwoLSLFloats() |
534 | { | 572 | { |
573 | TestHelpers.InMethod(); | ||
574 | |||
535 | LSL_Types.LSLFloat testResult; | 575 | LSL_Types.LSLFloat testResult; |
536 | 576 | ||
537 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 577 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -547,6 +587,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
547 | [Test] | 587 | [Test] |
548 | public void TestSubtractTwoLSLFloats() | 588 | public void TestSubtractTwoLSLFloats() |
549 | { | 589 | { |
590 | TestHelpers.InMethod(); | ||
591 | |||
550 | LSL_Types.LSLFloat testResult; | 592 | LSL_Types.LSLFloat testResult; |
551 | 593 | ||
552 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 594 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -562,6 +604,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
562 | [Test] | 604 | [Test] |
563 | public void TestMultiplyTwoLSLFloats() | 605 | public void TestMultiplyTwoLSLFloats() |
564 | { | 606 | { |
607 | TestHelpers.InMethod(); | ||
608 | |||
565 | LSL_Types.LSLFloat testResult; | 609 | LSL_Types.LSLFloat testResult; |
566 | 610 | ||
567 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 611 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -577,6 +621,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
577 | [Test] | 621 | [Test] |
578 | public void TestDivideTwoLSLFloats() | 622 | public void TestDivideTwoLSLFloats() |
579 | { | 623 | { |
624 | TestHelpers.InMethod(); | ||
625 | |||
580 | LSL_Types.LSLFloat testResult; | 626 | LSL_Types.LSLFloat testResult; |
581 | 627 | ||
582 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) | 628 | foreach (KeyValuePair<double, double> number in m_doubleDoubleSet) |
@@ -595,6 +641,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
595 | [Test] | 641 | [Test] |
596 | public void TestImplicitCastBooleanToLSLFloat() | 642 | public void TestImplicitCastBooleanToLSLFloat() |
597 | { | 643 | { |
644 | TestHelpers.InMethod(); | ||
645 | |||
598 | LSL_Types.LSLFloat testFloat; | 646 | LSL_Types.LSLFloat testFloat; |
599 | 647 | ||
600 | testFloat = (1 == 0); | 648 | testFloat = (1 == 0); |
@@ -610,4 +658,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
610 | Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); | 658 | Assert.That(testFloat.value, new DoubleToleranceConstraint(1.0, _lowPrecisionTolerance)); |
611 | } | 659 | } |
612 | } | 660 | } |
613 | } | 661 | } \ No newline at end of file |