| 57 | |
| 58 | |
| 59 | void |
| 60 | testMatrix () |
| 61 | { |
| 62 | cout << "Testing functions in ImathMatrix.h" << endl; |
| 63 | |
| 64 | union |
| 65 | { |
| 66 | float f; |
| 67 | int i; |
| 68 | } nanf; |
| 69 | nanf.i = 0x7f800001; // NAN |
| 70 | |
| 71 | union |
| 72 | { |
| 73 | double d; |
| 74 | uint64_t i; |
| 75 | } nand; |
| 76 | nand.i = 0x7ff0000000000001ULL; // NAN |
| 77 | |
| 78 | { |
| 79 | cout << "Imath::M22f constructors and equality operators" << endl; |
| 80 | |
| 81 | IMATH_INTERNAL_NAMESPACE::M22f m1; |
| 82 | m1[0][0] = 99.0f; |
| 83 | m1[1][1] = 101.0f; |
| 84 | |
| 85 | const IMATH_INTERNAL_NAMESPACE::M22f test (m1); |
| 86 | assert (test == m1); |
| 87 | |
| 88 | IMATH_INTERNAL_NAMESPACE::M22f test2; |
| 89 | assert (test != test2); |
| 90 | |
| 91 | IMATH_INTERNAL_NAMESPACE::M22f test3; |
| 92 | test3.makeIdentity (); |
| 93 | assert (test2 == test3); |
| 94 | |
| 95 | const float a[2][2] = { |
| 96 | { 1.0f, 0.0f }, |
| 97 | { 0.0f, 1.0f } |
| 98 | }; |
| 99 | testMatrix22ArrayConstructor(a); |
| 100 | |
| 101 | m1 = 42; |
| 102 | assert (m1[0][0] == 42 && m1[0][1] == 42 && m1[1][0] == 42 && m1[1][1] == 42); |
| 103 | |
| 104 | const float* i1 = test.getValue(); |
| 105 | assert(i1[0] == 99.0f); |
| 106 | assert(i1[3] == 101.0f); |
| 107 | |
| 108 | float* i2 = m1.getValue(); |
| 109 | assert(i2[0] == 42.0f); |
| 110 | assert(i2[1] == 42.0f); |
| 111 | assert(i2[2] == 42.0f); |
| 112 | assert(i2[3] == 42.0f); |
| 113 | |
| 114 | IMATH_INTERNAL_NAMESPACE::M22f test4; |
| 115 | test.getValue(test4); |
| 116 | assert (test == test4); |
nothing calls this directly
no test coverage detected