| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright Contributors to the OpenVDB Project | ||
| 2 | // SPDX-License-Identifier: MPL-2.0 | ||
| 3 | |||
| 4 | #include "CompareGrids.h" | ||
| 5 | #include "TestHarness.h" | ||
| 6 | |||
| 7 | #include "../util.h" | ||
| 8 | |||
| 9 | #include <openvdb_ax/compiler/CustomData.h> | ||
| 10 | #include <openvdb_ax/Exceptions.h> | ||
| 11 | |||
| 12 | #include <cppunit/extensions/HelperMacros.h> | ||
| 13 | |||
| 14 | using namespace openvdb::points; | ||
| 15 | |||
| 16 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | class TestArrayUnpack : public unittest_util::AXTestCase |
| 17 | { | ||
| 18 | public: | ||
| 19 | |||
| 20 |
3/6✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 22 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 22 times.
✗ Branch 8 not taken.
|
66 | std::string dir() const override { return GET_TEST_DIRECTORY(); } |
| 21 | |||
| 22 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
4 | CPPUNIT_TEST_SUITE(TestArrayUnpack); |
| 23 |
5/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
|
6 | CPPUNIT_TEST(componentVectorAssignment); |
| 24 |
5/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
|
6 | CPPUNIT_TEST(componentMatrixAssignment); |
| 25 |
4/8✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
|
4 | CPPUNIT_TEST_SUITE_END(); |
| 26 | |||
| 27 | void componentVectorAssignment(); | ||
| 28 | void componentMatrixAssignment(); | ||
| 29 | }; | ||
| 30 | |||
| 31 | CPPUNIT_TEST_SUITE_REGISTRATION(TestArrayUnpack); | ||
| 32 | |||
| 33 | void | ||
| 34 | 1 | TestArrayUnpack::componentVectorAssignment() | |
| 35 | { | ||
| 36 | 1 | const std::string code = R"( | |
| 37 | vec2@test1[0] = vec2@test2[1]; | ||
| 38 | vec2@test2[1] = vec2@test1[0]; | ||
| 39 | |||
| 40 | vec3@test3[1] = vec3@test3[2]; | ||
| 41 | vec3@test4[2] = vec3@test4[0]; | ||
| 42 | vec3@test3[0] = vec3@test4[1]; | ||
| 43 | |||
| 44 | vec4@test5[0] = vec4@test6[2]; | ||
| 45 | vec4@test5[3] = vec4@test5[1]; | ||
| 46 | vec4@test5[2] = vec4@test6[3]; | ||
| 47 | vec4@test6[1] = vec4@test6[0]; | ||
| 48 | )"; | ||
| 49 | |||
| 50 | 1 | auto generate = [&](const auto& suffixes) { | |
| 51 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
|
4 | for (const auto& s : suffixes) { |
| 52 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | std::string repl = code; |
| 53 |
6/8✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
3 | const std::string type = (s == 'i' ? "int" : (s == 'f' ? "float" : (s == 'd' ? "double" : ""))); |
| 54 |
6/12✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 3 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 3 times.
✗ Branch 17 not taken.
|
3 | CPPUNIT_ASSERT(!type.empty()); |
| 55 | |||
| 56 |
4/8✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
|
6 | unittest_util::replace(repl, "vec2", std::string("vec2").append(1, s)); |
| 57 |
4/8✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
|
6 | unittest_util::replace(repl, "vec3", std::string("vec3").append(1, s)); |
| 58 |
4/8✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
|
6 | unittest_util::replace(repl, "vec4", std::string("vec4").append(1, s)); |
| 59 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | this->registerTest(repl, "array_unpack.vec." + type + ".ax"); |
| 60 | |||
| 61 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | unittest_util::replace(repl, "[0]", ".x"); |
| 62 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | unittest_util::replace(repl, "[1]", ".y"); |
| 63 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | unittest_util::replace(repl, "[2]", ".z"); |
| 64 |
4/8✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
|
6 | this->registerTest(repl, "array_unpack.vec." + type + ".xyz" + ".ax"); |
| 65 | |||
| 66 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | unittest_util::replace(repl, ".x", ".r"); |
| 67 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | unittest_util::replace(repl, ".y", ".g"); |
| 68 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
|
6 | unittest_util::replace(repl, ".z", ".b"); |
| 69 |
4/8✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
|
6 | this->registerTest(repl, "array_unpack.vec." + type + ".rgb" + ".ax"); |
| 70 | } | ||
| 71 | 1 | }; | |
| 72 | |||
| 73 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | generate(std::vector<char>{'i', 'f', 'd'}); |
| 74 | |||
| 75 | const std::map<std::string, std::function<void()>> expected = { | ||
| 76 | 3 | { "int", [&]() { | |
| 77 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec2<int32_t>>("test1", openvdb::math::Vec2<int32_t>( 1, 2), openvdb::math::Vec2<int32_t>( 4,2)); |
| 78 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec2<int32_t>>("test2", openvdb::math::Vec2<int32_t>( 3, 4), openvdb::math::Vec2<int32_t>( 3, 4)); |
| 79 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec3<int32_t>>("test3", openvdb::math::Vec3<int32_t>( 5 ,6, 7), openvdb::math::Vec3<int32_t>( 8 ,7, 7)); |
| 80 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec3<int32_t>>("test4", openvdb::math::Vec3<int32_t>( 9, 8,-1), openvdb::math::Vec3<int32_t>( 9, 8, 9)); |
| 81 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec4<int32_t>>("test5", openvdb::math::Vec4<int32_t>(-1,-2,-3,-4), openvdb::math::Vec4<int32_t>(-7,-2,-8,-2)); |
| 82 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec4<int32_t>>("test6", openvdb::math::Vec4<int32_t>(-5,-6,-7,-8), openvdb::math::Vec4<int32_t>(-5,-5,-7,-8)); |
| 83 | 3 | } | |
| 84 | }, | ||
| 85 | 3 | { "float", [&]() { | |
| 86 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec2<float>>("test1", openvdb::math::Vec2<float>( 1.2f, 2.7f), openvdb::math::Vec2<float>(4.7f, 2.7f)); |
| 87 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec2<float>>("test2", openvdb::math::Vec2<float>( 3.2f, 4.7f), openvdb::math::Vec2<float>(3.2f ,4.7f)); |
| 88 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec3<float>>("test3", openvdb::math::Vec3<float>( 5.2f ,6.7f, 7.4f), openvdb::math::Vec3<float>( 8.7f ,7.4f, 7.4f)); |
| 89 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec3<float>>("test4", openvdb::math::Vec3<float>( 9.2f, 8.7f,-1.4f), openvdb::math::Vec3<float>( 9.2f, 8.7f, 9.2f)); |
| 90 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec4<float>>("test5", openvdb::math::Vec4<float>(-1.2f,-2.7f,-3.4f,-4.1f), openvdb::math::Vec4<float>(-7.4f,-2.7f,-8.1f,-2.7f)); |
| 91 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec4<float>>("test6", openvdb::math::Vec4<float>(-5.2f,-6.7f,-7.4f,-8.1f), openvdb::math::Vec4<float>(-5.2f,-5.2f,-7.4f,-8.1f)); |
| 92 | 3 | } | |
| 93 | }, | ||
| 94 | 3 | { "double", [&]() { | |
| 95 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec2<double>>("test1", openvdb::math::Vec2<double>( 1.2, 2.7), openvdb::math::Vec2<double>(4.7, 2.7)); |
| 96 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec2<double>>("test2", openvdb::math::Vec2<double>( 3.2, 4.7), openvdb::math::Vec2<double>(3.2, 4.7)); |
| 97 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec3<double>>("test3", openvdb::math::Vec3<double>( 5.2 ,6.7, 7.4), openvdb::math::Vec3<double>( 8.7 ,7.4, 7.4)); |
| 98 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec3<double>>("test4", openvdb::math::Vec3<double>( 9.2, 8.7,-1.4), openvdb::math::Vec3<double>( 9.2, 8.7, 9.2)); |
| 99 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec4<double>>("test5", openvdb::math::Vec4<double>(-1.2,-2.7,-3.4,-4.1), openvdb::math::Vec4<double>(-7.4,-2.7,-8.1,-2.7)); |
| 100 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | mHarness.addAttribute<openvdb::math::Vec4<double>>("test6", openvdb::math::Vec4<double>(-5.2,-6.7,-7.4,-8.1), openvdb::math::Vec4<double>(-5.2,-5.2,-7.4,-8.1)); |
| 101 | 3 | } | |
| 102 | }, | ||
| 103 |
4/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
7 | }; |
| 104 | |||
| 105 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
|
1 | const std::array<std::string, 3> suffixes {{ "", ".xyz", ".rgb" }}; |
| 106 | |||
| 107 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
|
4 | for (const auto& expc : expected) { |
| 108 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 3 times.
|
12 | for (const auto& suffix : suffixes) { |
| 109 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
9 | mHarness.reset(); |
| 110 |
1/2✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
|
9 | expc.second.operator()(); |
| 111 |
3/8✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
27 | this->execute("array_unpack.vec." + expc.first + suffix + ".ax"); |
| 112 | } | ||
| 113 | } | ||
| 114 | 1 | } | |
| 115 | |||
| 116 | void | ||
| 117 | 1 | TestArrayUnpack::componentMatrixAssignment() | |
| 118 | { | ||
| 119 | 1 | const std::string code = R"( | |
| 120 | mat3@test1[0] = mat3@test2[4]; | ||
| 121 | mat3@test2[1] = mat3@test1[0]; | ||
| 122 | mat3@test1[2] = mat3@test2[5]; | ||
| 123 | mat3@test2[3] = mat3@test1[6]; | ||
| 124 | mat3@test1[4] = mat3@test2[3]; | ||
| 125 | mat3@test2[5] = mat3@test1[1]; | ||
| 126 | mat3@test1[6] = mat3@test2[7]; | ||
| 127 | mat3@test2[7] = mat3@test1[8]; | ||
| 128 | mat3@test1[8] = mat3@test2[2]; | ||
| 129 | |||
| 130 | mat3@test3[0,0] = mat3@test4[1,1]; | ||
| 131 | mat3@test4[0,1] = mat3@test3[0,0]; | ||
| 132 | mat3@test3[0,2] = mat3@test4[1,2]; | ||
| 133 | mat3@test4[1,0] = mat3@test3[2,0]; | ||
| 134 | mat3@test3[1,1] = mat3@test4[1,0]; | ||
| 135 | mat3@test4[1,2] = mat3@test3[0,1]; | ||
| 136 | mat3@test3[2,0] = mat3@test4[2,1]; | ||
| 137 | mat3@test4[2,1] = mat3@test3[2,2]; | ||
| 138 | mat3@test3[2,2] = mat3@test4[0,2]; | ||
| 139 | |||
| 140 | mat4@test5[0] = mat4@test6[15]; | ||
| 141 | mat4@test6[1] = mat4@test5[0]; | ||
| 142 | mat4@test5[2] = mat4@test6[11]; | ||
| 143 | mat4@test6[3] = mat4@test5[6]; | ||
| 144 | mat4@test5[4] = mat4@test6[13]; | ||
| 145 | mat4@test6[5] = mat4@test5[1]; | ||
| 146 | mat4@test5[6] = mat4@test6[10]; | ||
| 147 | mat4@test6[7] = mat4@test5[8]; | ||
| 148 | mat4@test5[8] = mat4@test6[2]; | ||
| 149 | mat4@test6[9] = mat4@test5[7]; | ||
| 150 | mat4@test5[10] = mat4@test6[14]; | ||
| 151 | mat4@test6[11] = mat4@test5[3]; | ||
| 152 | mat4@test5[12] = mat4@test6[4]; | ||
| 153 | mat4@test6[13] = mat4@test5[12]; | ||
| 154 | mat4@test5[14] = mat4@test6[5]; | ||
| 155 | mat4@test6[15] = mat4@test5[9]; | ||
| 156 | |||
| 157 | mat4@test7[0,0] = mat4@test8[3,3]; | ||
| 158 | mat4@test8[0,1] = mat4@test7[0,0]; | ||
| 159 | mat4@test7[0,2] = mat4@test8[2,3]; | ||
| 160 | mat4@test8[0,3] = mat4@test7[1,2]; | ||
| 161 | mat4@test7[1,0] = mat4@test8[3,1]; | ||
| 162 | mat4@test8[1,1] = mat4@test7[0,1]; | ||
| 163 | mat4@test7[1,2] = mat4@test8[2,2]; | ||
| 164 | mat4@test8[1,3] = mat4@test7[2,0]; | ||
| 165 | mat4@test7[2,0] = mat4@test8[0,2]; | ||
| 166 | mat4@test8[2,1] = mat4@test7[1,3]; | ||
| 167 | mat4@test7[2,2] = mat4@test8[3,2]; | ||
| 168 | mat4@test8[2,3] = mat4@test7[0,3]; | ||
| 169 | mat4@test7[3,0] = mat4@test8[1,0]; | ||
| 170 | mat4@test8[3,1] = mat4@test7[3,0]; | ||
| 171 | mat4@test7[3,2] = mat4@test8[1,1]; | ||
| 172 | mat4@test8[3,3] = mat4@test7[2,1]; | ||
| 173 | )"; | ||
| 174 | |||
| 175 | 1 | auto generate = [&](const auto& suffixes) { | |
| 176 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | for (const auto& s : suffixes) { |
| 177 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | std::string repl = code; |
| 178 |
4/8✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
|
4 | unittest_util::replace(repl, "mat3", std::string("mat3").append(1,s)); |
| 179 |
4/8✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
|
4 | unittest_util::replace(repl, "mat4", std::string("mat4").append(1,s)); |
| 180 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
|
2 | const std::string type = s == 'f' ? "float" : s == 'd' ? "double" : ""; |
| 181 |
6/12✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 2 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 2 times.
✗ Branch 17 not taken.
|
2 | CPPUNIT_ASSERT(!type.empty()); |
| 182 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
4 | this->registerTest(repl, "array_unpack.mat." + type + ".ax"); |
| 183 | } | ||
| 184 | 1 | }; | |
| 185 | |||
| 186 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | generate(std::vector<char>{'f', 'd'}); |
| 187 | |||
| 188 | const std::map<std::string, std::function<void()>> expected = { | ||
| 189 | 1 | { "float", [&]() { | |
| 190 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<float>>("test1", |
| 191 | 1 | openvdb::math::Mat3<float>( 1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f), // in | |
| 192 | 1 | openvdb::math::Mat3<float>(-6.7f, 2.3f, 0.8f, 5.4f, 9.1f, 7.8f, -0.5f, 4.5f,-1.3f)); // expected | |
| 193 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<float>>("test2", |
| 194 | 1 | openvdb::math::Mat3<float>(9.1f, 7.3f, -1.3f, 4.4f, -6.7f, 0.8f, 9.1f,-0.5f, 8.2f), | |
| 195 | 1 | openvdb::math::Mat3<float>(9.1f,-6.7f, -1.3f, 9.1f, -6.7f, 2.3f, 9.1f, 8.2f, 8.2f)); | |
| 196 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<float>>("test3", |
| 197 | 1 | openvdb::math::Mat3<float>( 1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f), // in | |
| 198 | 1 | openvdb::math::Mat3<float>(-6.7f, 2.3f, 0.8f, 5.4f, 9.1f, 7.8f, -0.5f, 4.5f,-1.3f)); // expected | |
| 199 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<float>>("test4", |
| 200 | 1 | openvdb::math::Mat3<float>(9.1f, 7.3f, -1.3f, 4.4f, -6.7f, 0.8f, 9.1f,-0.5f, 8.2f), | |
| 201 | 1 | openvdb::math::Mat3<float>(9.1f,-6.7f, -1.3f, 9.1f, -6.7f, 2.3f, 9.1f, 8.2f, 8.2f)); | |
| 202 | |||
| 203 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<float>>("test5", |
| 204 | 1 | openvdb::math::Mat4<float>( 1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 3.3f, 2.9f, 5.9f, 0.1f, 0.3f, 5.1f, 1.9f), // in | |
| 205 | 1 | openvdb::math::Mat4<float>(-1.7f, 2.3f, 2.5f, 5.4f, 0.5f, 7.8f,-0.3f, 4.5f, -9.3f, 3.3f, 8.1f, 5.9f, -1.7f, 0.3f, 2.3f, 1.9f)); // expected | |
| 206 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<float>>("test6", |
| 207 | 1 | openvdb::math::Mat4<float>(0.1f, 2.3f,-9.3f, 4.5f, -1.7f, 7.8f, 2.1f, 3.3f, 3.3f,-3.3f,-0.3f, 2.5f, 5.1f, 0.5f, 8.1f,-1.7f), | |
| 208 | 1 | openvdb::math::Mat4<float>(0.1f,-1.7f,-9.3f, 9.1f, -1.7f, 2.3f, 2.1f, 8.2f, 3.3f, 4.5f,-0.3f, 5.4f, 5.1f,-1.7f, 8.1f, 3.3f)); | |
| 209 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<float>>("test7", |
| 210 | 1 | openvdb::math::Mat4<float>( 1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 3.3f, 2.9f, 5.9f, 0.1f, 0.3f, 5.1f, 1.9f), // in | |
| 211 | 1 | openvdb::math::Mat4<float>(-1.7f, 2.3f, 2.5f, 5.4f, 0.5f, 7.8f,-0.3f, 4.5f, -9.3f, 3.3f, 8.1f, 5.9f, -1.7f, 0.3f, 2.3f, 1.9f)); // expected | |
| 212 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<float>>("test8", |
| 213 | 1 | openvdb::math::Mat4<float>(0.1f, 2.3f,-9.3f, 4.5f, -1.7f, 7.8f, 2.1f, 3.3f, 3.3f,-3.3f,-0.3f, 2.5f, 5.1f, 0.5f, 8.1f,-1.7f), | |
| 214 | 1 | openvdb::math::Mat4<float>(0.1f,-1.7f,-9.3f, 9.1f, -1.7f, 2.3f, 2.1f, 8.2f, 3.3f, 4.5f,-0.3f, 5.4f, 5.1f,-1.7f, 8.1f, 3.3f)); | |
| 215 | 1 | } | |
| 216 | }, | ||
| 217 | 1 | { "double", [&]() { | |
| 218 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<double>>("test1", |
| 219 | 1 | openvdb::math::Mat3<double>( 1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2), // in | |
| 220 | 1 | openvdb::math::Mat3<double>(-6.7, 2.3, 0.8, 5.4, 9.1, 7.8, -0.5, 4.5,-1.3)); // expected | |
| 221 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<double>>("test2", |
| 222 | 1 | openvdb::math::Mat3<double>(9.1, 7.3, -1.3, 4.4, -6.7, 0.8, 9.1,-0.5, 8.2), | |
| 223 | 1 | openvdb::math::Mat3<double>(9.1,-6.7, -1.3, 9.1, -6.7, 2.3, 9.1, 8.2, 8.2)); | |
| 224 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<double>>("test3", |
| 225 | 1 | openvdb::math::Mat3<double>( 1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2), // in | |
| 226 | 1 | openvdb::math::Mat3<double>(-6.7, 2.3, 0.8, 5.4, 9.1, 7.8, -0.5, 4.5,-1.3)); // expected | |
| 227 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<double>>("test4", |
| 228 | 1 | openvdb::math::Mat3<double>(9.1, 7.3, -1.3, 4.4, -6.7, 0.8, 9.1,-0.5, 8.2), | |
| 229 | 1 | openvdb::math::Mat3<double>(9.1,-6.7, -1.3, 9.1, -6.7, 2.3, 9.1, 8.2, 8.2)); | |
| 230 | |||
| 231 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<double>>("test5", |
| 232 | 1 | openvdb::math::Mat4<double>( 1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 3.3, 2.9, 5.9, 0.1, 0.3, 5.1, 1.9), // in | |
| 233 | 1 | openvdb::math::Mat4<double>(-1.7, 2.3, 2.5, 5.4, 0.5, 7.8,-0.3, 4.5, -9.3, 3.3, 8.1, 5.9, -1.7, 0.3, 2.3, 1.9)); // expected | |
| 234 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<double>>("test6", |
| 235 | 1 | openvdb::math::Mat4<double>(0.1, 2.3,-9.3, 4.5, -1.7, 7.8, 2.1, 3.3, 3.3,-3.3,-0.3, 2.5, 5.1, 0.5, 8.1,-1.7), | |
| 236 | 1 | openvdb::math::Mat4<double>(0.1,-1.7,-9.3, 9.1, -1.7, 2.3, 2.1, 8.2, 3.3, 4.5,-0.3, 5.4, 5.1,-1.7, 8.1, 3.3)); | |
| 237 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<double>>("test7", |
| 238 | 1 | openvdb::math::Mat4<double>( 1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 3.3, 2.9, 5.9, 0.1, 0.3, 5.1, 1.9), // in | |
| 239 | 1 | openvdb::math::Mat4<double>(-1.7, 2.3, 2.5, 5.4, 0.5, 7.8,-0.3, 4.5, -9.3, 3.3, 8.1, 5.9, -1.7, 0.3, 2.3, 1.9)); // expected | |
| 240 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<double>>("test8", |
| 241 | 1 | openvdb::math::Mat4<double>(0.1, 2.3,-9.3, 4.5, -1.7, 7.8, 2.1, 3.3, 3.3,-3.3,-0.3, 2.5, 5.1, 0.5, 8.1,-1.7), | |
| 242 | 1 | openvdb::math::Mat4<double>(0.1,-1.7,-9.3, 9.1, -1.7, 2.3, 2.1, 8.2, 3.3, 4.5,-0.3, 5.4, 5.1,-1.7, 8.1, 3.3)); | |
| 243 | 1 | } | |
| 244 | } | ||
| 245 |
3/8✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
6 | }; |
| 246 | |||
| 247 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | for (const auto& expc : expected) { |
| 248 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | mHarness.reset(); |
| 249 |
1/2✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
|
2 | expc.second.operator()(); |
| 250 |
3/6✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 2 times.
✗ Branch 8 not taken.
|
4 | this->execute("array_unpack.mat." + expc.first + ".ax"); |
| 251 | } | ||
| 252 | |||
| 253 | 1 | } | |
| 254 | |||
| 255 | |||
| 256 |