diff options
Diffstat (limited to 'linden/indra/test/v3math_tut.cpp')
-rw-r--r-- | linden/indra/test/v3math_tut.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/linden/indra/test/v3math_tut.cpp b/linden/indra/test/v3math_tut.cpp index 4f4e7e0..40f649d 100644 --- a/linden/indra/test/v3math_tut.cpp +++ b/linden/indra/test/v3math_tut.cpp | |||
@@ -4,7 +4,9 @@ | |||
4 | * @date 2007-02 | 4 | * @date 2007-02 |
5 | * @brief v3math test cases. | 5 | * @brief v3math test cases. |
6 | * | 6 | * |
7 | * Copyright (c) 2007-2007, Linden Research, Inc. | 7 | * $LicenseInfo:firstyear=2007&license=viewergpl$ |
8 | * | ||
9 | * Copyright (c) 2007, Linden Research, Inc. | ||
8 | * | 10 | * |
9 | * Second Life Viewer Source Code | 11 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 12 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -26,9 +28,11 @@ | |||
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 28 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 29 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
28 | * COMPLETENESS OR PERFORMANCE. | 30 | * COMPLETENESS OR PERFORMANCE. |
31 | * $/LicenseInfo$ | ||
29 | */ | 32 | */ |
30 | 33 | ||
31 | #include <tut/tut.h> | 34 | #include <tut/tut.h> |
35 | #include "linden_common.h" | ||
32 | #include "lltut.h" | 36 | #include "lltut.h" |
33 | #include "llquaternion.h" | 37 | #include "llquaternion.h" |
34 | #include "linden_common.h" | 38 | #include "linden_common.h" |
@@ -390,9 +394,6 @@ namespace tut | |||
390 | template<> template<> | 394 | template<> template<> |
391 | void v3math_object::test<22>() | 395 | void v3math_object::test<22>() |
392 | { | 396 | { |
393 | #if (LL_RELEASE && LL_LINUX) | ||
394 | skip_fail("Doesn't work under Linux -- FIX ME!"); | ||
395 | #endif | ||
396 | F32 x1 =1.f, y1 = 2.f,z1 = 1.2f, x2 = -2.3f, y2 = 1.11f, z2 = 1234.234f; | 397 | F32 x1 =1.f, y1 = 2.f,z1 = 1.2f, x2 = -2.3f, y2 = 1.11f, z2 = 1234.234f; |
397 | F32 val1,val2,val3; | 398 | F32 val1,val2,val3; |
398 | LLVector3 vec3(x1,y1,z1), vec3a(x2,y2,z2); | 399 | LLVector3 vec3(x1,y1,z1), vec3a(x2,y2,z2); |
@@ -407,7 +408,7 @@ namespace tut | |||
407 | val1 = x1*mulVal; | 408 | val1 = x1*mulVal; |
408 | val2 = y1*mulVal; | 409 | val2 = y1*mulVal; |
409 | val3 = z1*mulVal; | 410 | val3 = z1*mulVal; |
410 | ensure("2:operator*= failed ", (val1 == vec3.mV[VX]) && (val2 == vec3.mV[VY]) && (val3 == vec3.mV[VZ])); | 411 | ensure("2:operator*= failed ", is_approx_equal(val1, vec3.mV[VX]) && is_approx_equal(val2, vec3.mV[VY]) && is_approx_equal(val3, vec3.mV[VZ])); |
411 | } | 412 | } |
412 | 413 | ||
413 | template<> template<> | 414 | template<> template<> |
@@ -527,15 +528,12 @@ namespace tut | |||
527 | template<> template<> | 528 | template<> template<> |
528 | void v3math_object::test<32>() | 529 | void v3math_object::test<32>() |
529 | { | 530 | { |
530 | #if (LL_RELEASE && LL_LINUX) | ||
531 | skip_fail("Doesn't work under Linux -- FIX ME!"); | ||
532 | #endif | ||
533 | F32 x =12.3524f, y = -342.f,z = 4.126341f; | 531 | F32 x =12.3524f, y = -342.f,z = 4.126341f; |
534 | LLVector3 vec3(x,y,z); | 532 | LLVector3 vec3(x,y,z); |
535 | F32 mag = vec3.normVec(); | 533 | F32 mag = vec3.normVec(); |
536 | mag = 1.f/ mag; | 534 | mag = 1.f/ mag; |
537 | F32 val1 = x* mag, val2 = y* mag, val3 = z* mag; | 535 | F32 val1 = x* mag, val2 = y* mag, val3 = z* mag; |
538 | ensure("1:normVec: Fail ", (val1 == vec3.mV[VX]) && (val2 == vec3.mV[VY])&& (val3 == vec3.mV[VZ])); | 536 | ensure("1:normVec: Fail ", is_approx_equal(val1, vec3.mV[VX]) && is_approx_equal(val2, vec3.mV[VY]) && is_approx_equal(val3, vec3.mV[VZ])); |
539 | x = 0.000000001f, y = 0.f, z = 0.f; | 537 | x = 0.000000001f, y = 0.f, z = 0.f; |
540 | vec3.clearVec(); | 538 | vec3.clearVec(); |
541 | vec3.setVec(x,y,z); | 539 | vec3.setVec(x,y,z); |
@@ -556,9 +554,6 @@ namespace tut | |||
556 | template<> template<> | 554 | template<> template<> |
557 | void v3math_object::test<34>() | 555 | void v3math_object::test<34>() |
558 | { | 556 | { |
559 | #if (LL_RELEASE && LL_LINUX) | ||
560 | skip_fail("Doesn't work under Linux -- FIX ME!"); | ||
561 | #endif | ||
562 | F32 x = 10.f, y = 20.f, z = -15.f; | 557 | F32 x = 10.f, y = 20.f, z = -15.f; |
563 | F32 x1, y1, z1; | 558 | F32 x1, y1, z1; |
564 | F32 lowerxy = 0.f, upperxy = 1.0f, lowerz = -1.0f, upperz = 1.f; | 559 | F32 lowerxy = 0.f, upperxy = 1.0f, lowerz = -1.0f, upperz = 1.f; |
@@ -567,12 +562,12 @@ namespace tut | |||
567 | x1 = U16_to_F32(F32_to_U16(x, lowerxy, upperxy), lowerxy, upperxy); | 562 | x1 = U16_to_F32(F32_to_U16(x, lowerxy, upperxy), lowerxy, upperxy); |
568 | y1 = U16_to_F32(F32_to_U16(y, lowerxy, upperxy), lowerxy, upperxy); | 563 | y1 = U16_to_F32(F32_to_U16(y, lowerxy, upperxy), lowerxy, upperxy); |
569 | z1 = U16_to_F32(F32_to_U16(z, lowerz, upperz), lowerz, upperz); | 564 | z1 = U16_to_F32(F32_to_U16(z, lowerz, upperz), lowerz, upperz); |
570 | ensure("1:quantize16: Fail ", (x1 == vec3.mV[VX]) && (y1 == vec3.mV[VY])&& (z1 == vec3.mV[VZ])); | 565 | ensure("1:quantize16: Fail ", is_approx_equal(x1, vec3.mV[VX]) && is_approx_equal(y1, vec3.mV[VY]) && is_approx_equal(z1, vec3.mV[VZ])); |
571 | LLVector3 vec3a(x,y,z); | 566 | LLVector3 vec3a(x,y,z); |
572 | vec3a.quantize8(lowerxy,upperxy,lowerz,upperz); | 567 | vec3a.quantize8(lowerxy,upperxy,lowerz,upperz); |
573 | x1 = U8_to_F32(F32_to_U8(x, lowerxy, upperxy), lowerxy, upperxy); | 568 | x1 = U8_to_F32(F32_to_U8(x, lowerxy, upperxy), lowerxy, upperxy); |
574 | y1 = U8_to_F32(F32_to_U8(y, lowerxy, upperxy), lowerxy, upperxy); | 569 | y1 = U8_to_F32(F32_to_U8(y, lowerxy, upperxy), lowerxy, upperxy); |
575 | z1 = U8_to_F32(F32_to_U8(z, lowerz, upperz), lowerz, upperz); | 570 | z1 = U8_to_F32(F32_to_U8(z, lowerz, upperz), lowerz, upperz); |
576 | ensure("2:quantize8: Fail ", (x1 == vec3a.mV[VX]) && (y1 == vec3a.mV[VY])&& (z1 == vec3a.mV[VZ])); | 571 | ensure("2:quantize8: Fail ", is_approx_equal(x1, vec3a.mV[VX]) && is_approx_equal(y1, vec3a.mV[VY]) && is_approx_equal(z1, vec3a.mV[VZ])); |
577 | } | 572 | } |
578 | } | 573 | } |