GCC Code Coverage Report


Directory: ./
File: openvdb_ax/openvdb_ax/test/integration/TestAssign.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 574 574 100.0%
Functions: 102 102 100.0%
Branches: 825 1630 50.6%

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 // Configuration values for assignment code
17
18 static const unittest_util::ConfigMap integral = {
19 { "bool", { { "_l1_", "true" }, { "_l2_", "false" } } },
20 { "int32", { { "_l1_", "2" }, { "_l2_", "3" } } },
21 { "int64", { { "_l1_", "2l" }, { "_l2_", "3l" } } }
22 };
23
24 static const unittest_util::ConfigMap floating = {
25 { "float", { { "_l1_", "1.1f" }, { "_l2_", "2.3f" } } },
26 { "double", { { "_l1_", "1.1" }, { "_l2_", "2.3" } } }
27 };
28
29 static const unittest_util::ConfigMap vec2 = {
30 { "vec2i", { { "_l1_", "{1, 2}" }, { "_l2_", "{3, 4}" } } },
31 { "vec2f", { { "_l1_", "{1.1f, 2.3f}" }, { "_l2_", "{4.1f, 5.3f}" } } },
32 { "vec2d", { { "_l1_", "{1.1, 2.3}" }, { "_l2_", "{4.1, 5.3}" } } }
33 };
34
35 static const unittest_util::ConfigMap vec3 = {
36 { "vec3i", { { "_l1_", "{1, 2, 3}" }, { "_l2_", "{4, 5, 6}" } } },
37 { "vec3f", { { "_l1_", "{1.1f, 2.3f, 4.3f}" }, { "_l2_", "{4.1f, 5.3f, 6.3f}" } } },
38 { "vec3d", { { "_l1_", "{1.1, 2.3 , 4.3}" }, { "_l2_", "{4.1, 5.3, 6.3}" } } }
39 };
40
41 static const unittest_util::ConfigMap vec4 = {
42 { "vec4i", { { "_l1_", "{1, 2, 3, 4}" }, { "_l2_", "{5, 6, 7, 8}" } } },
43 { "vec4f", { { "_l1_", "{1.1f, 2.3f, 4.3f, 5.4f}" }, { "_l2_", "{5.1f, 6.3f, 7.3f, 8.4f}" } } },
44 { "vec4d", { { "_l1_", "{1.1, 2.3, 4.3, 5.4}" }, { "_l2_", "{5.1, 6.3, 7.3, 8.4}" } } }
45 };
46
47 static const unittest_util::ConfigMap mat3 = {
48 { "mat3f", { { "_l1_", "{1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f }" },
49 { "_l2_", "{9.1f, 7.3f, -1.3f, 4.4f, -6.7f, 0.8f, 9.1f,-0.5f, 8.2f }" } }
50 },
51 { "mat3d", { { "_l1_", "{1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2 }" },
52 { "_l2_", "{9.1, 7.3, -1.3, 4.4, -6.7, 0.8, 9.1,-0.5, 8.2 }" } }
53 }
54 };
55
56 static const unittest_util::ConfigMap mat4 = {
57 { "mat4f", { { "_l1_", "{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}" },
58 { "_l2_", "{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}" } }
59 },
60 { "mat4d", { { "_l1_", "{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}" },
61 { "_l2_", "{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}" } }
62 }
63 };
64
65 static const unittest_util::ConfigMap string = {
66 { "string", { { "_l1_", "\"foo\"" }, { "_l2_", "\"bar\"" } } }
67 };
68
69 //
70
71
2/4
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
10 class TestAssign : public unittest_util::AXTestCase
72 {
73 public:
74
75
3/6
✓ Branch 1 taken 162 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 162 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 162 times.
✗ Branch 8 not taken.
486 std::string dir() const override { return GET_TEST_DIRECTORY(); }
76
77
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(TestAssign);
78
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(directAssignment);
79
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(compoundIntegralAssignment);
80
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(compoundFloatingAssignment);
81
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(compoundVectorAssignment);
82
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(compoundMatrixAssignment);
83
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(compoundStringAssignment);
84
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(implicitScalarAssignment);
85
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(implicitContainerAssignment);
86
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(implicitContainerScalarAssignment);
87
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(scopedAssign);
88
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();
89
90 void directAssignment();
91 void compoundIntegralAssignment();
92 void compoundFloatingAssignment();
93 void compoundVectorAssignment();
94 void compoundMatrixAssignment();
95 void compoundStringAssignment();
96 void implicitScalarAssignment();
97 void implicitContainerAssignment();
98 void implicitContainerScalarAssignment();
99 void scopedAssign();
100 };
101
102 CPPUNIT_TEST_SUITE_REGISTRATION(TestAssign);
103
104 void
105 1 TestAssign::directAssignment()
106 {
107 1 const std::string code = R"(
108 _T1_@test1 = _l1_;
109 _T1_ local1 = _l1_;
110 _T1_@test2 = local1;
111 _T1_@test3 =
112 _T1_@test4 =
113 _T1_@test2;
114 _T1_ local3,
115 local2 = _l2_;
116 _T1_@test5 =
117 local3 =
118 local2;
119 _T1_@test6 = _l2_,
120 _T1_@test7 = _l1_;
121 _T1_@test8 = _l2_;
122 _T1_@test8 = _l1_;
123 )";
124
125 8 auto generate = [&](const auto& map) {
126
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 8 times.
27 for (const auto& config : map) {
127
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 std::string repl = code;
128
2/4
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
38 unittest_util::replace(repl, "_T1_", config.first); // replace type
129 // replace literal values
130
2/2
✓ Branch 0 taken 38 times.
✓ Branch 1 taken 19 times.
57 for (const auto& settings : config.second) {
131
1/2
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
38 unittest_util::replace(repl, settings.first, settings.second);
132 }
133
134
3/6
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
38 this->registerTest(repl, "assign." + config.first + ".ax");
135 }
136 8 };
137
138
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
139
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
140
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
141
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
142
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
143
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat3);
144
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat4);
145
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(string);
146
147
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 const auto names = unittest_util::nameSequence("test", 8);
148 const std::map<std::string, std::function<void()>> expected = {
149 { "bool",
150
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<bool>(names,
151 { true, true, true, true, false, false, true, true });
152 1 },
153 },
154 { "int32",
155
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<int32_t>(names,
156 { 2, 2, 2, 2, 3, 3, 2, 2 });
157 1 },
158 },
159 { "int64",
160
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<int64_t>(names,
161 { 2, 2, 2, 2, 3, 3, 2, 2 });
162 1 },
163 },
164 { "float",
165
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<float>(names,
166 { 1.1f, 1.1f, 1.1f, 1.1f, 2.3f, 2.3f, 1.1f, 1.1f });
167 1 },
168 },
169 { "double",
170
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<double>(names,
171 { 1.1, 1.1, 1.1, 1.1, 2.3, 2.3, 1.1, 1.1 });
172 1 },
173 },
174 { "vec2i",
175
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec2<int32_t>>(names,
176 { openvdb::math::Vec2<int32_t>(1,2),
177 openvdb::math::Vec2<int32_t>(1,2),
178 openvdb::math::Vec2<int32_t>(1,2),
179 openvdb::math::Vec2<int32_t>(1,2),
180 openvdb::math::Vec2<int32_t>(3,4),
181 openvdb::math::Vec2<int32_t>(3,4),
182 openvdb::math::Vec2<int32_t>(1,2),
183 openvdb::math::Vec2<int32_t>(1,2)
184 });
185 1 },
186 },
187 { "vec2f",
188
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec2<float>>(names,
189 { openvdb::math::Vec2<float>(1.1f, 2.3f),
190 openvdb::math::Vec2<float>(1.1f, 2.3f),
191 openvdb::math::Vec2<float>(1.1f, 2.3f),
192 openvdb::math::Vec2<float>(1.1f, 2.3f),
193 openvdb::math::Vec2<float>(4.1f, 5.3f),
194 openvdb::math::Vec2<float>(4.1f, 5.3f),
195 openvdb::math::Vec2<float>(1.1f, 2.3f),
196 openvdb::math::Vec2<float>(1.1f, 2.3f)
197 });
198 1 },
199 },
200 { "vec2d",
201
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec2<double>>(names,
202 { openvdb::math::Vec2<double>(1.1, 2.3),
203 openvdb::math::Vec2<double>(1.1, 2.3),
204 openvdb::math::Vec2<double>(1.1, 2.3),
205 openvdb::math::Vec2<double>(1.1, 2.3),
206 openvdb::math::Vec2<double>(4.1, 5.3),
207 openvdb::math::Vec2<double>(4.1, 5.3),
208 openvdb::math::Vec2<double>(1.1, 2.3),
209 openvdb::math::Vec2<double>(1.1, 2.3)
210 });
211 1 },
212 },
213 { "vec3i",
214
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec3<int32_t>>(names,
215 { openvdb::math::Vec3<int32_t>(1,2,3),
216 openvdb::math::Vec3<int32_t>(1,2,3),
217 openvdb::math::Vec3<int32_t>(1,2,3),
218 openvdb::math::Vec3<int32_t>(1,2,3),
219 openvdb::math::Vec3<int32_t>(4,5,6),
220 openvdb::math::Vec3<int32_t>(4,5,6),
221 openvdb::math::Vec3<int32_t>(1,2,3),
222 openvdb::math::Vec3<int32_t>(1,2,3)
223 });
224 1 },
225 },
226 { "vec3f",
227
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec3<float>>(names,
228 { openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f),
229 openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f),
230 openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f),
231 openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f),
232 openvdb::math::Vec3<float>(4.1f, 5.3f, 6.3f),
233 openvdb::math::Vec3<float>(4.1f, 5.3f, 6.3f),
234 openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f),
235 openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f)
236 });
237 1 },
238 },
239 { "vec3d",
240
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec3<double>>(names,
241 { openvdb::math::Vec3<double>(1.1, 2.3, 4.3),
242 openvdb::math::Vec3<double>(1.1, 2.3, 4.3),
243 openvdb::math::Vec3<double>(1.1, 2.3, 4.3),
244 openvdb::math::Vec3<double>(1.1, 2.3, 4.3),
245 openvdb::math::Vec3<double>(4.1, 5.3, 6.3),
246 openvdb::math::Vec3<double>(4.1, 5.3, 6.3),
247 openvdb::math::Vec3<double>(1.1, 2.3, 4.3),
248 openvdb::math::Vec3<double>(1.1, 2.3, 4.3)
249 });
250 1 },
251 },
252 { "vec4i",
253
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec4<int32_t>>(names,
254 { openvdb::math::Vec4<int32_t>(1, 2, 3, 4),
255 openvdb::math::Vec4<int32_t>(1, 2, 3, 4),
256 openvdb::math::Vec4<int32_t>(1, 2, 3, 4),
257 openvdb::math::Vec4<int32_t>(1, 2, 3, 4),
258 openvdb::math::Vec4<int32_t>(5, 6, 7, 8),
259 openvdb::math::Vec4<int32_t>(5, 6, 7, 8),
260 openvdb::math::Vec4<int32_t>(1, 2, 3, 4),
261 openvdb::math::Vec4<int32_t>(1, 2, 3, 4)
262 });
263 1 },
264 },
265 { "vec4f",
266
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec4<float>>(names,
267 { openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f),
268 openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f),
269 openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f),
270 openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f),
271 openvdb::math::Vec4<float>(5.1f, 6.3f, 7.3f, 8.4f),
272 openvdb::math::Vec4<float>(5.1f, 6.3f, 7.3f, 8.4f),
273 openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f),
274 openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f)
275 });
276 1 },
277 },
278 { "vec4d",
279
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec4<double>>(names,
280 { openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4),
281 openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4),
282 openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4),
283 openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4),
284 openvdb::math::Vec4<double>(5.1, 6.3, 7.3, 8.4),
285 openvdb::math::Vec4<double>(5.1, 6.3, 7.3, 8.4),
286 openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4),
287 openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4)
288 });
289 1 },
290 },
291 { "mat3f",
292
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat3<float>>(names,
293 { openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f),
294 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f),
295 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f),
296 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f),
297 openvdb::math::Mat3<float>(9.1f, 7.3f, -1.3f, 4.4f, -6.7f, 0.8f, 9.1f, -0.5f, 8.2f),
298 openvdb::math::Mat3<float>(9.1f, 7.3f, -1.3f, 4.4f, -6.7f, 0.8f, 9.1f, -0.5f, 8.2f),
299 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f),
300 openvdb::math::Mat3<float>(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f)
301 });
302 1 },
303 },
304 { "mat3d",
305
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat3<double>>(names,
306 { openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2),
307 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2),
308 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2),
309 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2),
310 openvdb::math::Mat3<double>(9.1, 7.3, -1.3, 4.4, -6.7, 0.8, 9.1, -0.5, 8.2),
311 openvdb::math::Mat3<double>(9.1, 7.3, -1.3, 4.4, -6.7, 0.8, 9.1, -0.5, 8.2),
312 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2),
313 openvdb::math::Mat3<double>(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2)
314 });
315 1 },
316 },
317 { "mat4f",
318
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat4<float>>(names,
319 { 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),
320 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),
321 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),
322 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),
323 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),
324 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),
325 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),
326 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)
327 });
328 1 },
329 },
330 { "mat4d",
331
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat4<double>>(names,
332 { 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),
333 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),
334 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),
335 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),
336 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),
337 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),
338 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),
339 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)
340 });
341 1 },
342 },
343 { "string",
344
12/24
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 8 times.
✓ Branch 32 taken 1 times.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
9 [&](){ mHarness.addAttributes<std::string>(names,
345 { "foo", "foo", "foo", "foo", "bar", "bar", "foo", "foo" });
346 1 },
347 }
348
20/42
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 50 not taken.
✓ Branch 52 taken 1 times.
✗ Branch 53 not taken.
✓ Branch 55 taken 1 times.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✓ Branch 59 taken 1 times.
✗ Branch 61 not taken.
✗ Branch 62 not taken.
40 };
349
350
2/2
✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
20 for (const auto& expc : expected) {
351
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 mHarness.reset();
352
1/2
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
19 expc.second.operator()();
353
3/6
✓ Branch 1 taken 19 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 19 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 19 times.
✗ Branch 8 not taken.
38 this->execute("assign." + expc.first + ".ax");
354 }
355 1 }
356
357 void
358 1 TestAssign::compoundIntegralAssignment()
359 {
360 1 const std::string code = R"(
361 _T1_@test1 += _l1_;
362 _T1_@test2 -= _l1_;
363 _T1_@test3 *= _l1_;
364 _T1_@test4 /= _l1_;
365 _T1_@test5 %= _l1_;
366 _T1_@test6 <<= _l1_;
367 _T1_@test7 >>= _l1_;
368 _T1_@test8 &= _l1_;
369 _T1_@test9 ^= _l1_;
370 _T1_@test10 |= _l1_;
371
372 _T1_ local1 = _l1_,
373 local2 = _l2_;
374
375 local1 += local2;
376 _T1_@test11 = local1;
377 _T1_@test12 += _T1_@test13;
378 _T1_@test14 += local2;
379 )";
380
381 1 auto generate = [&](const auto& map) {
382
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 for (const auto& config : map) {
383
1/2
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
3 std::string repl = code;
384
2/4
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
6 unittest_util::replace(repl, "_T1_", config.first); // replace type
385 // replace literal values
386
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
9 for (const auto& settings : config.second) {
387
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 unittest_util::replace(repl, settings.first, settings.second);
388 }
389
390
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, "assign_compound." + config.first + ".ax");
391 }
392 1 };
393
394
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(integral);
395
396
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 const auto names = unittest_util::nameSequence("test", 14);
397 const std::map<std::string, std::vector<std::function<void()>>> expected = {
398 { "bool", {
399
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<bool>(names,
400 { true, true, false, false, false, false, false, false, true, true, true, false, false, false });
401 1 },
402
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.
2 [&](){ mHarness.addAttributes<bool>(names,
403 { true, true, true, true, true, true, true, true, true, true, false, true, true, true }, // in
404 { true, false, true, true, false, true, false, true, false, true, true, true, true, true }); // expected
405 1 },
406 }
407 },
408 { "int32", {
409
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<int32_t>(names,
410 { 2, -2, 0, 0, 0, 0, 0, 0, 2, 2, 5, 0, 0, 3 });
411 1 },
412
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<int32_t>(names,
413 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 12, 13, 14 }, // in
414 { 3, 0, 6, 2, 1, 24, 1, 0, 11, 10, 5, 25, 13, 17 }); // expected
415 1 },
416 }
417 },
418 { "int64", {
419
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<int64_t>(names,
420 { 2, -2, 0, 0, 0, 0, 0, 0, 2, 2, 5, 0, 0, 3 });
421 1 },
422
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<int64_t>(names,
423 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 12, 13, 14 }, // in
424 { 3, 0, 6, 2, 1, 24, 1, 0, 11, 10, 5, 25, 13, 17 }); // expected
425 1 },
426 }
427 }
428
7/16
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 1 times.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
8 };
429
430
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 for (const auto& expc : expected) {
431
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
9 for (const auto& test : expc.second) {
432
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 mHarness.reset();
433
1/2
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
6 test.operator()();
434
3/6
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6 times.
✗ Branch 8 not taken.
12 this->execute("assign_compound." + expc.first + ".ax");
435 }
436 }
437 1 }
438
439 void
440 1 TestAssign::compoundFloatingAssignment()
441 {
442 1 const std::string code = R"(
443 _T1_@test1 += _l1_;
444 _T1_@test2 -= _l1_;
445 _T1_@test3 *= _l1_;
446 _T1_@test4 /= _l1_;
447 _T1_@test5 %= _l1_;
448
449 _T1_ local1 = _l1_,
450 local2 = _l2_;
451
452 local1 += local2;
453 _T1_@test6 = local1;
454 _T1_@test7 += _T1_@test8;
455 _T1_@test9 += local2;
456 )";
457
458 1 auto generate = [&](const auto& map) {
459
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (const auto& config : map) {
460
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 std::string repl = code;
461
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 unittest_util::replace(repl, "_T1_", config.first); // replace type
462 // replace literal values
463
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (const auto& settings : config.second) {
464
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 unittest_util::replace(repl, settings.first, settings.second);
465 }
466
467
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, "assign_compound." + config.first + ".ax");
468 }
469 1 };
470
471
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(floating);
472
473
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 const auto names = unittest_util::nameSequence("test", 9);
474 const std::map<std::string, std::vector<std::function<void()>>> expected = {
475 { "float", {
476
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<float>(names,
477 { 1.1f, -1.1f, 0.0f, 0.0f, 0.0f, (1.1f+2.3f), 0.0f, 0.0f, 2.3f });
478 1 },
479
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<float>(names,
480 { 1.1f, 2.3f, 4.5f, 6.7f, 8.9f, -1.1f, -2.3f, -4.5f, 6.1f }, // in
481 { (1.1f+1.1f), (2.3f-1.1f), (4.5f*1.1f), (6.7f/1.1f),
482 std::fmod(8.9f,1.1f),
483 (1.1f+2.3f), (-2.3f+-4.5f), (-4.5f), (6.1f+2.3f) }); // expected
484 1 }
485 }
486 },
487 { "double", {
488
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<double>(names,
489 { 1.1, -1.1, 0.0, 0.0, 0.0, (1.1+2.3), 0.0, 0.0, 2.3 });
490 1 },
491
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
2 [&](){ mHarness.addAttributes<double>(names,
492 { 1.1, 2.3, 4.5, 6.7, 8.9, -1.1, -2.3, -4.5, 6.1 }, // in
493 { (1.1+1.1), (2.3-1.1), (4.5*1.1), (6.7/1.1),
494
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::fmod(8.9,1.1),
495 (1.1+2.3), (-2.3+-4.5), (-4.5), (6.1+2.3) }); // expected
496 1 }
497 }
498 },
499
5/12
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
6 };
500
501
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (const auto& expc : expected) {
502
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (const auto& test : expc.second) {
503
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 mHarness.reset();
504
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 test.operator()();
505
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
8 this->execute("assign_compound." + expc.first + ".ax");
506 }
507 }
508 1 }
509
510
511 void
512 1 TestAssign::compoundVectorAssignment()
513 {
514 1 const std::string code = R"(
515 _T1_@test1 += _l1_;
516 _T1_@test2 -= _l1_;
517 _T1_@test3 *= _l1_;
518 _T1_@test4 /= _l1_;
519 _T1_@test5 %= _l1_;
520
521 _T1_ local1 = _l1_,
522 local2 = _l2_;
523
524 local1 += local2;
525 _T1_@test6 = local1;
526 _T1_@test7 += _T1_@test8;
527 _T1_@test9 += local2;
528 )";
529
530 3 auto generate = [&](const auto& map) {
531
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 3 times.
12 for (const auto& config : map) {
532
1/2
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
9 std::string repl = code;
533
2/4
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
18 unittest_util::replace(repl, "_T1_", config.first); // replace type
534 // replace literal values
535
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 9 times.
27 for (const auto& settings : config.second) {
536
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 unittest_util::replace(repl, settings.first, settings.second);
537 }
538
539
3/6
✓ 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.
18 this->registerTest(repl, "assign_compound." + config.first + ".ax");
540 }
541 3 };
542
543
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec2);
544
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec3);
545
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(vec4);
546
547
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 const auto names = unittest_util::nameSequence("test", 9);
548 const std::map<std::string, std::vector<std::function<void()>>> expected = {
549 { "vec2i", {
550
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec2<int32_t>>(names,
551 { openvdb::math::Vec2<int32_t>(1,2),
552 openvdb::math::Vec2<int32_t>(-1,-2),
553 openvdb::math::Vec2<int32_t>(0,0),
554 openvdb::math::Vec2<int32_t>(0,0),
555 openvdb::math::Vec2<int32_t>(0,0),
556 openvdb::math::Vec2<int32_t>(4,6),
557 openvdb::math::Vec2<int32_t>(0,0),
558 openvdb::math::Vec2<int32_t>(0,0),
559 openvdb::math::Vec2<int32_t>(3,4) });
560 1 },
561
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec2<int32_t>>(names,
562 { openvdb::math::Vec2<int32_t>(1,2),
563 openvdb::math::Vec2<int32_t>(3,4),
564 openvdb::math::Vec2<int32_t>(5,6),
565 openvdb::math::Vec2<int32_t>(7,8),
566 openvdb::math::Vec2<int32_t>(3,9),
567 openvdb::math::Vec2<int32_t>(9,-1),
568 openvdb::math::Vec2<int32_t>(-2,-3),
569 openvdb::math::Vec2<int32_t>(-4,-5),
570 openvdb::math::Vec2<int32_t>(-6,-7) }, // in
571 { openvdb::math::Vec2<int32_t>(2,4),
572 openvdb::math::Vec2<int32_t>(2,2),
573 openvdb::math::Vec2<int32_t>(5,12),
574 openvdb::math::Vec2<int32_t>(7,4),
575 openvdb::math::Vec2<int32_t>(0,1),
576 openvdb::math::Vec2<int32_t>(4,6),
577 openvdb::math::Vec2<int32_t>(-6,-8),
578 openvdb::math::Vec2<int32_t>(-4,-5),
579 openvdb::math::Vec2<int32_t>(-3,-3) }); // expected
580 1 }
581 }
582 },
583 { "vec2f", {
584
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec2<float>>(names,
585 { openvdb::math::Vec2<float>(1.1f,2.3f),
586 openvdb::math::Vec2<float>(-1.1f,-2.3f),
587 openvdb::math::Vec2<float>(0.0f,0.0f),
588 openvdb::math::Vec2<float>(0.0f,0.0f),
589 openvdb::math::Vec2<float>(0.0f,0.0f),
590
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<float>(1.1f, 2.3f) + openvdb::math::Vec2<float>(4.1f, 5.3f),
591 openvdb::math::Vec2<float>(0.0f,0.0f),
592 openvdb::math::Vec2<float>(0.0f,0.0f),
593 openvdb::math::Vec2<float>(4.1f,5.3f) });
594 1 },
595
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec2<float>>(names,
596 { openvdb::math::Vec2<float>(1.1f,2.2f),
597 openvdb::math::Vec2<float>(3.3f,4.4f),
598 openvdb::math::Vec2<float>(5.5f,6.6f),
599 openvdb::math::Vec2<float>(7.7f,8.8f),
600 openvdb::math::Vec2<float>(2.3f,5.5f),
601 openvdb::math::Vec2<float>(9.9f,-1.1f),
602 openvdb::math::Vec2<float>(-2.2f,-3.3f),
603 openvdb::math::Vec2<float>(-4.3f,-5.5f),
604 openvdb::math::Vec2<float>(-6.1f,-8.2f) }, // in
605
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 { openvdb::math::Vec2<float>(1.1f,2.2f) + openvdb::math::Vec2<float>(1.1f,2.3f),
606
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<float>(3.3f,4.4f) - openvdb::math::Vec2<float>(1.1f,2.3f),
607
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<float>(5.5f,6.6f) * openvdb::math::Vec2<float>(1.1f,2.3f),
608
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<float>(7.7f,8.8f) / openvdb::math::Vec2<float>(1.1f,2.3f),
609 openvdb::math::Vec2<float>(std::fmod(2.3f, 1.1f), std::fmod(5.5f, 2.3f)),
610 1 openvdb::math::Vec2<float>(1.1f, 2.3f) + openvdb::math::Vec2<float>(4.1f, 5.3f),
611 1 openvdb::math::Vec2<float>(-2.2f,-3.3f) + openvdb::math::Vec2<float>(-4.3f,-5.5f),
612 openvdb::math::Vec2<float>(-4.3f,-5.5f),
613
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<float>(-6.1f,-8.2f) + openvdb::math::Vec2<float>(4.1f,5.3f)
614 }); // expected
615 1 }
616 }
617 },
618 { "vec2d", {
619
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec2<double>>(names,
620 { openvdb::math::Vec2<double>(1.1,2.3),
621 openvdb::math::Vec2<double>(-1.1,-2.3),
622 openvdb::math::Vec2<double>(0.0,0.0),
623 openvdb::math::Vec2<double>(0.0,0.0),
624 openvdb::math::Vec2<double>(0.0,0.0),
625
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<double>(1.1, 2.3) + openvdb::math::Vec2<double>(4.1, 5.3),
626 openvdb::math::Vec2<double>(0.0,0.0),
627 openvdb::math::Vec2<double>(0.0,0.0),
628 openvdb::math::Vec2<double>(4.1,5.3) });
629 1 },
630
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec2<double>>(names,
631 { openvdb::math::Vec2<double>(1.1,2.2),
632 openvdb::math::Vec2<double>(3.3,4.4),
633 openvdb::math::Vec2<double>(5.5,6.6),
634 openvdb::math::Vec2<double>(7.7,8.8),
635 openvdb::math::Vec2<double>(2.3,5.5),
636 openvdb::math::Vec2<double>(9.9,-1.1),
637 openvdb::math::Vec2<double>(-2.2,-3.3),
638 openvdb::math::Vec2<double>(-4.3,-5.5),
639 openvdb::math::Vec2<double>(-6.1,-8.2) }, // in
640
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 { openvdb::math::Vec2<double>(1.1,2.2) + openvdb::math::Vec2<double>(1.1,2.3),
641
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<double>(3.3,4.4) - openvdb::math::Vec2<double>(1.1,2.3),
642
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<double>(5.5,6.6) * openvdb::math::Vec2<double>(1.1,2.3),
643 1 openvdb::math::Vec2<double>(7.7,8.8) / openvdb::math::Vec2<double>(1.1,2.3),
644 openvdb::math::Vec2<double>(std::fmod(2.3, 1.1), std::fmod(5.5, 2.3)),
645 1 openvdb::math::Vec2<double>(1.1, 2.3) + openvdb::math::Vec2<double>(4.1, 5.3),
646 1 openvdb::math::Vec2<double>(-2.2,-3.3) + openvdb::math::Vec2<double>(-4.3,-5.5),
647 openvdb::math::Vec2<double>(-4.3,-5.5),
648
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec2<double>(-6.1,-8.2) + openvdb::math::Vec2<double>(4.1,5.3)
649 }); // expected
650 1 }
651 }
652 },
653 { "vec3i", {
654
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec3<int32_t>>(names,
655 { openvdb::math::Vec3<int32_t>(1,2,3),
656 openvdb::math::Vec3<int32_t>(-1,-2,-3),
657 openvdb::math::Vec3<int32_t>(0,0,0),
658 openvdb::math::Vec3<int32_t>(0,0,0),
659 openvdb::math::Vec3<int32_t>(0,0,0),
660 openvdb::math::Vec3<int32_t>(5,7,9),
661 openvdb::math::Vec3<int32_t>(0,0,0),
662 openvdb::math::Vec3<int32_t>(0,0,0),
663 openvdb::math::Vec3<int32_t>(4,5,6) });
664 1 },
665
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec3<int32_t>>(names,
666 { openvdb::math::Vec3<int32_t>(1,2,3),
667 openvdb::math::Vec3<int32_t>(4,5,6),
668 openvdb::math::Vec3<int32_t>(7,8,9),
669 openvdb::math::Vec3<int32_t>(-1,-2,-3),
670 openvdb::math::Vec3<int32_t>(4,-5,6),
671 openvdb::math::Vec3<int32_t>(5,7,9),
672 openvdb::math::Vec3<int32_t>(-7,-8,-9),
673 openvdb::math::Vec3<int32_t>(-1,2,-3),
674 openvdb::math::Vec3<int32_t>(-4,5,-6) }, // in
675 { openvdb::math::Vec3<int32_t>(2,4,6),
676 openvdb::math::Vec3<int32_t>(3,3,3),
677 openvdb::math::Vec3<int32_t>(7,16,27),
678 openvdb::math::Vec3<int32_t>(-1,-1,-1),
679 openvdb::math::Vec3<int32_t>(0,1,0),
680 openvdb::math::Vec3<int32_t>(5,7,9),
681 openvdb::math::Vec3<int32_t>(-8,-6,-12),
682 openvdb::math::Vec3<int32_t>(-1,2,-3),
683 openvdb::math::Vec3<int32_t>(0,10,0) }); // expected
684 1 }
685 }
686 },
687 { "vec3f", {
688
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec3<float>>(names,
689 { openvdb::math::Vec3<float>(1.1f,2.3f,4.3f),
690 openvdb::math::Vec3<float>(-1.1f,-2.3f,-4.3f),
691 openvdb::math::Vec3<float>(0.0f,0.0f,0.0f),
692 openvdb::math::Vec3<float>(0.0f,0.0f,0.0f),
693 openvdb::math::Vec3<float>(0.0f,0.0f,0.0f),
694
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f) + openvdb::math::Vec3<float>(4.1f, 5.3f, 6.3f),
695 openvdb::math::Vec3<float>(0.0f,0.0f,0.0f),
696 openvdb::math::Vec3<float>(0.0f,0.0f,0.0f),
697 openvdb::math::Vec3<float>(4.1f, 5.3f, 6.3f) });
698 1 },
699
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec3<float>>(names,
700 { openvdb::math::Vec3<float>(1.1f,2.2f,3.3f),
701 openvdb::math::Vec3<float>(3.3f,4.4f,5.5f),
702 openvdb::math::Vec3<float>(5.5f,6.6f,7.7f),
703 openvdb::math::Vec3<float>(7.7f,8.8f,9.9f),
704 openvdb::math::Vec3<float>(7.7f,8.8f,9.9f),
705 openvdb::math::Vec3<float>(9.9f,-1.1f,-2.2f),
706 openvdb::math::Vec3<float>(-2.2f,-3.3f,-4.4f),
707 openvdb::math::Vec3<float>(-4.3f,-5.5f,-6.6f),
708 openvdb::math::Vec3<float>(-7.1f,8.5f,-9.9f), }, // in
709
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 { openvdb::math::Vec3<float>(1.1f,2.2f,3.3f) + openvdb::math::Vec3<float>(1.1f,2.3f,4.3f),
710
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec3<float>(3.3f,4.4f,5.5f) - openvdb::math::Vec3<float>(1.1f,2.3f,4.3f),
711
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec3<float>(5.5f,6.6f,7.7f) * openvdb::math::Vec3<float>(1.1f,2.3f,4.3f),
712
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec3<float>(7.7f,8.8f,9.9f) / openvdb::math::Vec3<float>(1.1f,2.3f,4.3f),
713 openvdb::math::Vec3<float>(std::fmod(7.7f,1.1f), std::fmod(8.8f,2.3f), std::fmod(9.9f,4.3f)),
714 1 openvdb::math::Vec3<float>(1.1f, 2.3f, 4.3f) + openvdb::math::Vec3<float>(4.1f, 5.3f, 6.3f),
715 1 openvdb::math::Vec3<float>(-2.2f,-3.3f,-4.4f) + openvdb::math::Vec3<float>(-4.3f,-5.5f,-6.6f),
716 openvdb::math::Vec3<float>(-4.3f,-5.5f,-6.6f),
717
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec3<float>(-7.1f,8.5f,-9.9f) + openvdb::math::Vec3<float>(4.1f, 5.3f, 6.3f)
718 }); // expected
719 1 }
720 }
721 },
722 { "vec3d", {
723
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec3<double>>(names,
724 { openvdb::math::Vec3<double>(1.1,2.3,4.3),
725 openvdb::math::Vec3<double>(-1.1,-2.3,-4.3),
726 openvdb::math::Vec3<double>(0.0,0.0,0.0),
727 openvdb::math::Vec3<double>(0.0,0.0,0.0),
728 openvdb::math::Vec3<double>(0.0,0.0,0.0),
729 openvdb::math::Vec3<double>(1.1, 2.3, 4.3) + openvdb::math::Vec3<double>(4.1, 5.3, 6.3),
730 openvdb::math::Vec3<double>(0.0,0.0,0.0),
731 openvdb::math::Vec3<double>(0.0,0.0,0.0),
732 openvdb::math::Vec3<double>(4.1, 5.3, 6.3) });
733 1 },
734
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec3<double>>(names,
735 { openvdb::math::Vec3<double>(1.1,2.2,3.3),
736 openvdb::math::Vec3<double>(3.3,4.4,5.5),
737 openvdb::math::Vec3<double>(5.5,6.6,7.7),
738 openvdb::math::Vec3<double>(7.7,8.8,9.9),
739 openvdb::math::Vec3<double>(7.7,8.8,9.9),
740 openvdb::math::Vec3<double>(9.9,-1.1,-2.2),
741 openvdb::math::Vec3<double>(-2.2,-3.3,-4.4),
742 openvdb::math::Vec3<double>(-4.3,-5.5,-6.6),
743 openvdb::math::Vec3<double>(-7.1,8.5,-9.9), }, // in
744 { openvdb::math::Vec3<double>(1.1,2.2,3.3) + openvdb::math::Vec3<double>(1.1,2.3,4.3),
745 openvdb::math::Vec3<double>(3.3,4.4,5.5) - openvdb::math::Vec3<double>(1.1,2.3,4.3),
746 openvdb::math::Vec3<double>(5.5,6.6,7.7) * openvdb::math::Vec3<double>(1.1,2.3,4.3),
747 openvdb::math::Vec3<double>(7.7,8.8,9.9) / openvdb::math::Vec3<double>(1.1,2.3,4.3),
748 openvdb::math::Vec3<double>(std::fmod(7.7,1.1), std::fmod(8.8,2.3), std::fmod(9.9,4.3)),
749 openvdb::math::Vec3<double>(1.1, 2.3, 4.3) + openvdb::math::Vec3<double>(4.1, 5.3, 6.3),
750 openvdb::math::Vec3<double>(-2.2,-3.3,-4.4) + openvdb::math::Vec3<double>(-4.3,-5.5,-6.6),
751 openvdb::math::Vec3<double>(-4.3,-5.5,-6.6),
752 openvdb::math::Vec3<double>(-7.1,8.5,-9.9) + openvdb::math::Vec3<double>(4.1, 5.3, 6.3)
753 }); // expected
754 1 }
755 }
756 },
757 { "vec4i", {
758
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec4<int32_t>>(names,
759 { openvdb::math::Vec4<int32_t>(1,2,3,4),
760 openvdb::math::Vec4<int32_t>(-1,-2,-3,-4),
761 openvdb::math::Vec4<int32_t>(0,0,0,0),
762 openvdb::math::Vec4<int32_t>(0,0,0,0),
763 openvdb::math::Vec4<int32_t>(0,0,0,0),
764 openvdb::math::Vec4<int32_t>(6,8,10,12),
765 openvdb::math::Vec4<int32_t>(0,0,0,0),
766 openvdb::math::Vec4<int32_t>(0,0,0,0),
767 openvdb::math::Vec4<int32_t>(5,6,7,8) });
768 1 },
769
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec4<int32_t>>(names,
770 { openvdb::math::Vec4<int32_t>(1,2,3,4),
771 openvdb::math::Vec4<int32_t>(4,5,6,7),
772 openvdb::math::Vec4<int32_t>(7,8,9,-1),
773 openvdb::math::Vec4<int32_t>(-1,-2,-3,1),
774 openvdb::math::Vec4<int32_t>(-4,-5,-6,2),
775 openvdb::math::Vec4<int32_t>(4,5,-6,2),
776 openvdb::math::Vec4<int32_t>(-7,-8,-9,3),
777 openvdb::math::Vec4<int32_t>(-1,2,-3,4),
778 openvdb::math::Vec4<int32_t>(-5,6,-7,8) }, // in
779 { openvdb::math::Vec4<int32_t>(2,4,6,8),
780 openvdb::math::Vec4<int32_t>(3,3,3,3),
781 openvdb::math::Vec4<int32_t>(7,16,27,-4),
782 openvdb::math::Vec4<int32_t>(-1,-1,-1,0),
783 openvdb::math::Vec4<int32_t>(0,1,0,2),
784 openvdb::math::Vec4<int32_t>(6,8,10,12),
785 openvdb::math::Vec4<int32_t>(-8,-6,-12,7),
786 openvdb::math::Vec4<int32_t>(-1,2,-3,4),
787 openvdb::math::Vec4<int32_t>(0,12,0,16) }); // expected
788 1 }
789 }
790 },
791 { "vec4f", {
792
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec4<float>>(names,
793 { openvdb::math::Vec4<float>(1.1f,2.3f,4.3f,5.4f),
794 openvdb::math::Vec4<float>(-1.1f,-2.3f,-4.3f,-5.4f),
795 openvdb::math::Vec4<float>(0.0f,0.0f,0.0f,0.0f),
796 openvdb::math::Vec4<float>(0.0f,0.0f,0.0f,0.0f),
797 openvdb::math::Vec4<float>(0.0f,0.0f,0.0f,0.0f),
798
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f) + openvdb::math::Vec4<float>(5.1f, 6.3f, 7.3f, 8.4f),
799 openvdb::math::Vec4<float>(0.0f,0.0f,0.0f,0.0f),
800 openvdb::math::Vec4<float>(0.0f,0.0f,0.0f,0.0f),
801 openvdb::math::Vec4<float>(5.1f, 6.3f, 7.3f, 8.4f) });
802 1 },
803
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec4<float>>(names,
804 { openvdb::math::Vec4<float>(1.1f,2.2f,3.3f,4.4f),
805 openvdb::math::Vec4<float>(3.3f,4.4f,5.5f,6.6f),
806 openvdb::math::Vec4<float>(5.5f,6.6f,7.7f,8.8f),
807 openvdb::math::Vec4<float>(7.7f,8.8f,9.9f,-1.1f),
808 openvdb::math::Vec4<float>(7.7f,8.8f,9.9f,-1.1f),
809 openvdb::math::Vec4<float>(9.9f,-1.1f,-2.2f,-3.3f),
810 openvdb::math::Vec4<float>(-2.2f,-3.3f,-4.4f,-5.5f),
811 openvdb::math::Vec4<float>(-4.3f,-5.5f,-6.6f,-7.7f),
812 openvdb::math::Vec4<float>(-8.2f,-9.3f,0.6f,-1.7f) }, // in
813
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 { openvdb::math::Vec4<float>(1.1f,2.2f,3.3f,4.4f) + openvdb::math::Vec4<float>(1.1f,2.3f,4.3f,5.4f),
814
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<float>(3.3f,4.4f,5.5f,6.6f) - openvdb::math::Vec4<float>(1.1f,2.3f,4.3f,5.4f),
815
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<float>(5.5f,6.6f,7.7f,8.8f) * openvdb::math::Vec4<float>(1.1f,2.3f,4.3f,5.4f),
816
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<float>(7.7f,8.8f,9.9f,-1.1f) / openvdb::math::Vec4<float>(1.1f,2.3f,4.3f,5.4f),
817 openvdb::math::Vec4<float>(std::fmod(7.7f,1.1f),std::fmod(8.8f,2.3f),std::fmod(9.9f,4.3f),std::fmod(-1.1f,5.4f)+5.4f), // floored mod
818 1 openvdb::math::Vec4<float>(1.1f, 2.3f, 4.3f, 5.4f) + openvdb::math::Vec4<float>(5.1f, 6.3f, 7.3f, 8.4f),
819 1 openvdb::math::Vec4<float>(-2.2f,-3.3f,-4.4f,-5.5f) + openvdb::math::Vec4<float>(-4.3f,-5.5f,-6.6f,-7.7f),
820 openvdb::math::Vec4<float>(-4.3f,-5.5f,-6.6f,-7.7f),
821
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<float>(-8.2f,-9.3f,0.6f,-1.7f) + openvdb::math::Vec4<float>(5.1f, 6.3f, 7.3f, 8.4f)
822 }); // expected
823 1 }
824 }
825 },
826 { "vec4d", {
827
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Vec4<double>>(names,
828 { openvdb::math::Vec4<double>(1.1,2.3,4.3,5.4),
829 openvdb::math::Vec4<double>(-1.1,-2.3,-4.3,-5.4),
830 openvdb::math::Vec4<double>(0.0,0.0,0.0,0.0),
831 openvdb::math::Vec4<double>(0.0,0.0,0.0,0.0),
832 openvdb::math::Vec4<double>(0.0,0.0,0.0,0.0),
833 openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4) + openvdb::math::Vec4<double>(5.1, 6.3, 7.3, 8.4),
834 openvdb::math::Vec4<double>(0.0,0.0,0.0,0.0),
835 openvdb::math::Vec4<double>(0.0,0.0,0.0,0.0),
836 openvdb::math::Vec4<double>(5.1, 6.3, 7.3, 8.4) });
837 1 },
838
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Vec4<double>>(names,
839 { openvdb::math::Vec4<double>(1.1,2.2,3.3,4.4),
840 openvdb::math::Vec4<double>(3.3,4.4,5.5,6.6),
841 openvdb::math::Vec4<double>(5.5,6.6,7.7,8.8),
842 openvdb::math::Vec4<double>(7.7,8.8,9.9,-1.1),
843 openvdb::math::Vec4<double>(7.7,8.8,9.9,-1.1),
844 openvdb::math::Vec4<double>(9.9,-1.1,-2.2,-3.3),
845 openvdb::math::Vec4<double>(-2.2,-3.3,-4.4,-5.5),
846 openvdb::math::Vec4<double>(-4.3,-5.5,-6.6,-7.7),
847 openvdb::math::Vec4<double>(-8.2,-9.3,0.6,-1.7) }, // in
848 { openvdb::math::Vec4<double>(1.1,2.2,3.3,4.4) + openvdb::math::Vec4<double>(1.1,2.3,4.3,5.4),
849 openvdb::math::Vec4<double>(3.3,4.4,5.5,6.6) - openvdb::math::Vec4<double>(1.1,2.3,4.3,5.4),
850 openvdb::math::Vec4<double>(5.5,6.6,7.7,8.8) * openvdb::math::Vec4<double>(1.1,2.3,4.3,5.4),
851 openvdb::math::Vec4<double>(7.7,8.8,9.9,-1.1) / openvdb::math::Vec4<double>(1.1,2.3,4.3,5.4),
852
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<double>(std::fmod(7.7,1.1),std::fmod(8.8,2.3),std::fmod(9.9,4.3),std::fmod(-1.1,5.4)+5.4), // floored mod
853 openvdb::math::Vec4<double>(1.1, 2.3, 4.3, 5.4) + openvdb::math::Vec4<double>(5.1, 6.3, 7.3, 8.4),
854 openvdb::math::Vec4<double>(-2.2,-3.3,-4.4,-5.5) + openvdb::math::Vec4<double>(-4.3,-5.5,-6.6,-7.7),
855 openvdb::math::Vec4<double>(-4.3,-5.5,-6.6,-7.7),
856 openvdb::math::Vec4<double>(-8.2,-9.3,0.6,-1.7) + openvdb::math::Vec4<double>(5.1, 6.3, 7.3, 8.4)
857 }); // expected
858 1 }
859 }
860 }
861
19/40
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✓ Branch 30 taken 1 times.
✗ Branch 31 not taken.
✓ Branch 35 taken 1 times.
✗ Branch 36 not taken.
✓ Branch 38 taken 1 times.
✗ Branch 39 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✓ Branch 51 taken 1 times.
✗ Branch 52 not taken.
✓ Branch 54 taken 1 times.
✗ Branch 55 not taken.
✓ Branch 59 taken 1 times.
✗ Branch 60 not taken.
✓ Branch 62 taken 1 times.
✗ Branch 63 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✗ Branch 73 not taken.
✓ Branch 74 taken 1 times.
✗ Branch 85 not taken.
✗ Branch 86 not taken.
20 };
862
863
2/2
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 1 times.
10 for (const auto& expc : expected) {
864
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 9 times.
27 for (const auto& test : expc.second) {
865
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 mHarness.reset();
866
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
18 test.operator()();
867
3/6
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 18 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 18 times.
✗ Branch 8 not taken.
36 this->execute("assign_compound." + expc.first + ".ax");
868 }
869 }
870 1 }
871
872
873 void
874 1 TestAssign::compoundMatrixAssignment()
875 {
876 1 const std::string code = R"(
877 _T1_@test1 += _l1_;
878 _T1_@test2 -= _l1_;
879 _T1_@test3 *= _l1_;
880
881 _T1_ local1 = _l1_,
882 local2 = _l2_;
883
884 local1 += local2;
885 _T1_@test4 = local1;
886 _T1_@test5 += _T1_@test6;
887 _T1_@test7 += local2;
888 )";
889
890 2 auto generate = [&](const auto& map) {
891
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (const auto& config : map) {
892
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 std::string repl = code;
893
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
8 unittest_util::replace(repl, "_T1_", config.first); // replace type
894 // replace literal values
895
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 for (const auto& settings : config.second) {
896
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 unittest_util::replace(repl, settings.first, settings.second);
897 }
898
899
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
8 this->registerTest(repl, "assign_compound." + config.first + ".ax");
900 }
901 2 };
902
903
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat3);
904
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(mat4);
905
906 const openvdb::math::Mat3<float> m3fl1(1.1f, 2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f);
907 const openvdb::math::Mat3<float> m3fl2(9.1f, 7.3f,-1.3f, 4.4f,-6.7f, 0.8f, 9.1f,-0.5f, 8.2f);
908 const openvdb::math::Mat3<double> m3dl1(1.1, 2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2);
909 const openvdb::math::Mat3<double> m3dl2(9.1, 7.3,-1.3, 4.4,-6.7, 0.8, 9.1,-0.5, 8.2);
910
911 const openvdb::math::Mat4<float> m4fl1(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);
912 const openvdb::math::Mat4<float> m4fl2(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);
913 const openvdb::math::Mat4<double> m4dl1(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);
914 const openvdb::math::Mat4<double> m4dl2(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);
915
916
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 const auto names = unittest_util::nameSequence("test", 7);
917 const std::map<std::string, std::vector<std::function<void()>>> expected = {
918 { "mat3f", {
919
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat3<float>>(names,
920 1 { m3fl1,
921 -m3fl1,
922 1 openvdb::math::Mat3<float>::zero(),
923
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 m3fl1 + m3fl2,
924 1 openvdb::math::Mat3<float>::zero(),
925 1 openvdb::math::Mat3<float>::zero(),
926 m3fl2 });
927 1 },
928
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Mat3<float>>(names,
929 { openvdb::math::Mat3<float>(2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f),
930 openvdb::math::Mat3<float>(4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f),
931 openvdb::math::Mat3<float>(5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 4.3f),
932 openvdb::math::Mat3<float>(8.3f, 2.3f, 6.1f, 4.5f, 0.1f, 0.1f, 5.3f, 4.5f, 8.9f),
933 openvdb::math::Mat3<float>(6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 4.3f, 5.4f),
934 openvdb::math::Mat3<float>(7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 4.3f, 5.4f, 6.7f),
935 openvdb::math::Mat3<float>(-6.8f,-8.1f,-4.5f, 5.2f,-1.1f, 2.3f, -0.3f, 5.4f,-3.7f)
936 }, // in
937 1 { openvdb::math::Mat3<float>(2.3f, 4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f) + m3fl1,
938 1 openvdb::math::Mat3<float>(4.3f, 5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f) - m3fl1,
939 1 openvdb::math::Mat3<float>(5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 4.3f) * m3fl1,
940 1 m3fl1 + m3fl2,
941 1 openvdb::math::Mat3<float>(6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 4.3f, 5.4f) +
942 1 openvdb::math::Mat3<float>(7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 4.3f, 5.4f, 6.7f),
943 openvdb::math::Mat3<float>(7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 4.3f, 5.4f, 6.7f),
944 1 openvdb::math::Mat3<float>(-6.8f,-8.1f,-4.5f, 5.2f,-1.1f, 2.3f, -0.3f, 5.4f,-3.7f) + m3fl2
945 }); // expected
946 1 }
947 }
948 },
949 { "mat3d", {
950
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat3<double>>(names,
951 1 { m3dl1,
952 -m3dl1,
953 1 openvdb::math::Mat3<double>::zero(),
954
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 m3dl1 + m3dl2,
955 1 openvdb::math::Mat3<double>::zero(),
956 1 openvdb::math::Mat3<double>::zero(),
957 m3dl2 });
958 1 },
959
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Mat3<double>>(names,
960 { openvdb::math::Mat3<double>(2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1),
961 openvdb::math::Mat3<double>(4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3),
962 openvdb::math::Mat3<double>(5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 4.3),
963 openvdb::math::Mat3<double>(8.3, 2.3, 6.1, 4.5, 0.1, 0.1, 5.3, 4.5, 8.9),
964 openvdb::math::Mat3<double>(6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 4.3, 5.4),
965 openvdb::math::Mat3<double>(7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 4.3, 5.4, 6.7),
966 openvdb::math::Mat3<double>(-6.8,-8.1,-4.5, 5.2,-1.1, 2.3, -0.3, 5.4,-3.7)
967 }, // in
968 1 { openvdb::math::Mat3<double>(2.3, 4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1) + m3dl1,
969 1 openvdb::math::Mat3<double>(4.3, 5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3) - m3dl1,
970 1 openvdb::math::Mat3<double>(5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 4.3) * m3dl1,
971 1 m3dl1 + m3dl2,
972 1 openvdb::math::Mat3<double>(6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 4.3, 5.4) +
973 1 openvdb::math::Mat3<double>(7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 4.3, 5.4, 6.7),
974 openvdb::math::Mat3<double>(7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 4.3, 5.4, 6.7),
975 1 openvdb::math::Mat3<double>(-6.8,-8.1,-4.5, 5.2,-1.1, 2.3, -0.3, 5.4,-3.7) + m3dl2
976 }); // expected
977 1 }
978 }
979 },
980 { "mat4f", {
981
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat4<float>>(names,
982 2 { m4fl1,
983 1 -m4fl1,
984 1 openvdb::math::Mat4<float>::zero(),
985
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 m4fl1 + m4fl2,
986 1 openvdb::math::Mat4<float>::zero(),
987 1 openvdb::math::Mat4<float>::zero(),
988 m4fl2 });
989 1 },
990
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Mat4<float>>(names,
991 { openvdb::math::Mat4<float>(2.3f,-4.3f, 5.4f, 6.7f, 7.8f,-9.1f, 4.5f, 8.2f, 1.1f,-5.4f,-6.7f, 7.8f, 6.7f, 7.8f, 9.1f,-2.4f),
992 openvdb::math::Mat4<float>(4.3f,-5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 6.7f, 7.8f, 9.1f, -1.3f,-0.1f, 1.1f, 0.9f),
993 openvdb::math::Mat4<float>(5.4f, 6.7f, 7.8f, 9.1f, -4.5f, 8.2f, 1.1f,-2.3f, -4.3f,-7.8f, 9.1f, 4.5f, -6.7f, 2.2f,-7.1f, 1.1f),
994 openvdb::math::Mat4<float>(1.2f, 5.1f, 8.2f, 3.1f, -3.3f, -7.3f, 0.2f,-0.1f, 1.4f, 0.8f, 8.8f,-1.1f, -7.8f, 4.1f, 4.4f, -4.7f),
995 openvdb::math::Mat4<float>(5.4f, 6.7f, 8.2f, 1.1f, -2.3f, -4.3f, 2.2f,-7.1f, 1.1f, 7.8f, 9.1f,-4.5f, -7.8f, 9.1f, 4.5f, -6.7f),
996 openvdb::math::Mat4<float>(8.2f, 1.1f, 6.3f,-4.3f, 9.1f, -4.5f,-7.8f, 9.1f, 4.5f, 6.7f,-5.4f, 6.7f, 2.2f,-7.1f, 1.1f, 7.8f),
997 openvdb::math::Mat4<float>(4.3f,-5.1f,-5.3f, 2.2f, 2.1f, -4.2f, 2.3f,-1.1f, 0.5f, 0.7f, 1.3f, 0.7f, -1.2f, 3.4f, 9.9f, 9.8f),
998 }, // in
999 1 { openvdb::math::Mat4<float>(2.3f,-4.3f, 5.4f, 6.7f, 7.8f,-9.1f, 4.5f, 8.2f, 1.1f,-5.4f,-6.7f, 7.8f, 6.7f, 7.8f, 9.1f,-2.4f) + m4fl1,
1000 1 openvdb::math::Mat4<float>(4.3f,-5.4f, 6.7f, 7.8f, 9.1f, 4.5f, 8.2f, 1.1f, 2.3f, 6.7f, 7.8f, 9.1f, -1.3f,-0.1f, 1.1f, 0.9f) - m4fl1,
1001 1 openvdb::math::Mat4<float>(5.4f, 6.7f, 7.8f, 9.1f, -4.5f, 8.2f, 1.1f,-2.3f, -4.3f,-7.8f, 9.1f, 4.5f, -6.7f, 2.2f,-7.1f, 1.1f) * m4fl1,
1002 1 m4fl1 + m4fl2,
1003 1 openvdb::math::Mat4<float>(5.4f, 6.7f, 8.2f, 1.1f, -2.3f, -4.3f, 2.2f,-7.1f, 1.1f, 7.8f, 9.1f,-4.5f, -7.8f, 9.1f, 4.5f, -6.7f) +
1004 1 openvdb::math::Mat4<float>(8.2f, 1.1f, 6.3f,-4.3f, 9.1f, -4.5f,-7.8f, 9.1f, 4.5f, 6.7f,-5.4f, 6.7f, 2.2f,-7.1f, 1.1f, 7.8f),
1005 openvdb::math::Mat4<float>(8.2f, 1.1f, 6.3f,-4.3f, 9.1f, -4.5f,-7.8f, 9.1f, 4.5f, 6.7f,-5.4f, 6.7f, 2.2f,-7.1f, 1.1f, 7.8f),
1006 1 openvdb::math::Mat4<float>(4.3f,-5.1f,-5.3f, 2.2f, 2.1f, -4.2f, 2.3f,-1.1f, 0.5f, 0.7f, 1.3f, 0.7f, -1.2f, 3.4f, 9.9f, 9.8f) + m4fl2
1007 }); // expected
1008 1 }
1009 }
1010 },
1011 { "mat4d", {
1012
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 [&](){ mHarness.addAttributes<openvdb::math::Mat4<double>>(names,
1013 2 { m4dl1,
1014 1 -m4dl1,
1015 1 openvdb::math::Mat4<double>::zero(),
1016
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 m4dl1 + m4dl2,
1017 1 openvdb::math::Mat4<double>::zero(),
1018 1 openvdb::math::Mat4<double>::zero(),
1019 m4dl2 });
1020 1 },
1021
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 9 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
2 [&](){ mHarness.addAttributes<openvdb::math::Mat4<double>>(names,
1022 { openvdb::math::Mat4<double>(2.3,-4.3, 5.4, 6.7, 7.8,-9.1, 4.5, 8.2, 1.1,-5.4,-6.7, 7.8, 6.7, 7.8, 9.1,-2.4),
1023 openvdb::math::Mat4<double>(4.3,-5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 6.7, 7.8, 9.1, -1.3,-0.1, 1.1, 0.9),
1024 openvdb::math::Mat4<double>(5.4, 6.7, 7.8, 9.1, -4.5, 8.2, 1.1,-2.3, -4.3,-7.8, 9.1, 4.5, -6.7, 2.2,-7.1, 1.1),
1025 openvdb::math::Mat4<double>(1.2, 5.1, 8.2, 3.1, -3.3, -7.3, 0.2,-0.1, 1.4, 0.8, 8.8,-1.1, -7.8, 4.1, 4.4, -4.7),
1026 openvdb::math::Mat4<double>(5.4, 6.7, 8.2, 1.1, -2.3, -4.3, 2.2,-7.1, 1.1, 7.8, 9.1,-4.5, -7.8, 9.1, 4.5, -6.7),
1027 openvdb::math::Mat4<double>(8.2, 1.1, 6.3,-4.3, 9.1, -4.5,-7.8, 9.1, 4.5, 6.7,-5.4, 6.7, 2.2,-7.1, 1.1, 7.8),
1028 openvdb::math::Mat4<double>(4.3,-5.1,-5.3, 2.2, 2.1, -4.2, 2.3,-1.1, 0.5, 0.7, 1.3, 0.7, -1.2, 3.4, 9.9, 9.8),
1029 }, // in
1030 1 { openvdb::math::Mat4<double>(2.3,-4.3, 5.4, 6.7, 7.8,-9.1, 4.5, 8.2, 1.1,-5.4,-6.7, 7.8, 6.7, 7.8, 9.1,-2.4) + m4dl1,
1031 1 openvdb::math::Mat4<double>(4.3,-5.4, 6.7, 7.8, 9.1, 4.5, 8.2, 1.1, 2.3, 6.7, 7.8, 9.1, -1.3,-0.1, 1.1, 0.9) - m4dl1,
1032 1 openvdb::math::Mat4<double>(5.4, 6.7, 7.8, 9.1, -4.5, 8.2, 1.1,-2.3, -4.3,-7.8, 9.1, 4.5, -6.7, 2.2,-7.1, 1.1) * m4dl1,
1033 1 m4dl1 + m4dl2,
1034 1 openvdb::math::Mat4<double>(5.4, 6.7, 8.2, 1.1, -2.3, -4.3, 2.2,-7.1, 1.1, 7.8, 9.1,-4.5, -7.8, 9.1, 4.5, -6.7) +
1035 1 openvdb::math::Mat4<double>(8.2, 1.1, 6.3,-4.3, 9.1, -4.5,-7.8, 9.1, 4.5, 6.7,-5.4, 6.7, 2.2,-7.1, 1.1, 7.8),
1036 openvdb::math::Mat4<double>(8.2, 1.1, 6.3,-4.3, 9.1, -4.5,-7.8, 9.1, 4.5, 6.7,-5.4, 6.7, 2.2,-7.1, 1.1, 7.8),
1037 1 openvdb::math::Mat4<double>(4.3,-5.1,-5.3, 2.2, 2.1, -4.2, 2.3,-1.1, 0.5, 0.7, 1.3, 0.7, -1.2, 3.4, 9.9, 9.8) + m4dl2
1038 }); // expected
1039 1 }
1040 }
1041 }
1042
17/36
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 1 times.
✗ Branch 41 not taken.
✓ Branch 43 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 46 taken 1 times.
✗ Branch 47 not taken.
✗ Branch 49 not taken.
✓ Branch 50 taken 1 times.
✗ Branch 56 not taken.
✗ Branch 57 not taken.
10 };
1043
1044
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for (const auto& expc : expected) {
1045
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 for (const auto& test : expc.second) {
1046
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 mHarness.reset();
1047
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 test.operator()();
1048
3/6
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
16 this->execute("assign_compound." + expc.first + ".ax");
1049 }
1050 }
1051 1 }
1052
1053
1054 void
1055 1 TestAssign::compoundStringAssignment()
1056 {
1057 1 const std::string code = R"(
1058 _T1_@test1 += _l1_;
1059
1060 _T1_ local1 = _l1_,
1061 local2 = _l2_;
1062
1063 // test default init and empty string
1064 string empty = "";
1065 string defaultstr;
1066 local1 += local2;
1067 defaultstr += local1;
1068 defaultstr += empty;
1069
1070 _T1_@test2 = defaultstr;
1071 _T1_@test3 += _T1_@test4;
1072 _T1_@test5 += local2;
1073 )";
1074
1075 1 auto generate = [&](const auto& map) {
1076
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 for (const auto& config : map) {
1077
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::string repl = code;
1078
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 unittest_util::replace(repl, "_T1_", config.first); // replace type
1079 // replace literal values
1080
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (const auto& settings : config.second) {
1081
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 unittest_util::replace(repl, settings.first, settings.second);
1082 }
1083
1084
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.
2 this->registerTest(repl, "assign_compound." + config.first + ".ax");
1085 }
1086 1 };
1087
1088
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 generate(string);
1089
1090
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 const auto names = unittest_util::nameSequence("test", 5);
1091 const std::map<std::string, std::vector<std::function<void()>>> expected = {
1092 { "string", {
1093
9/18
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 5 times.
✓ Branch 23 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
6 [&](){ mHarness.addAttributes<std::string>(names,
1094 { "foo", "foobar", "", "", "bar" });
1095 1 },
1096
17/34
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✓ Branch 40 taken 5 times.
✓ Branch 41 taken 1 times.
✓ Branch 44 taken 5 times.
✓ Branch 45 taken 1 times.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✗ Branch 52 not taken.
✗ Branch 53 not taken.
11 [&](){ mHarness.addAttributes<std::string>(names,
1097 { "abc ", "xyz", " 123", "4560", " " }, // in
1098 { "abc foo", "foobar", " 1234560", "4560", " bar" }); // expected
1099 1 },
1100 }
1101 }
1102
3/8
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
4 };
1103
1104
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 for (const auto& expc : expected) {
1105
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (const auto& test : expc.second) {
1106
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 mHarness.reset();
1107
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 test.operator()();
1108
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("assign_compound." + expc.first + ".ax");
1109 }
1110 }
1111 1 }
1112
1113
1114 void
1115 1 TestAssign::implicitScalarAssignment()
1116 {
1117 2 auto generate = [this](const auto& source, const auto& targets) {
1118
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
7 for (const auto& t1 : source) {
1119
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 std::string code = "_T1_ local = _l1_;\n";
1120
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 unittest_util::replace(code, "_T1_", t1.first);
1121
4/8
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
10 unittest_util::replace(code, "_l1_", t1.second.at("_l1_"));
1122
1123
2/2
✓ Branch 0 taken 10 times.
✓ Branch 1 taken 5 times.
15 for (const auto& target : targets) {
1124
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 10 times.
35 for (const auto& t2 : *target) {
1125
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 20 times.
25 if (t1.first == t2.first) continue;
1126
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 std::string tmp = "_T2_@_A1_ = local;";
1127
3/6
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
40 unittest_util::replace(tmp, "_A1_", "test" + t2.first);
1128
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
20 unittest_util::replace(tmp, "_T2_", t2.first);
1129
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
40 code += tmp + "\n";
1130 }
1131 }
1132
1133
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 this->registerTest(code, "assign_implicit_scalar." + t1.first + ".ax");
1134 }
1135 2 };
1136
1137 // source -> dest
1138
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 generate(integral, std::vector<decltype(integral)*>{ &integral, &floating });
1139
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 generate(floating, std::vector<decltype(integral)*>{ &integral, &floating });
1140
1141 // source -> dest
1142 const std::map<std::string, std::function<void()>> expected = {
1143 1 { "bool", [&](){
1144
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint32", 1);
1145
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint64", 1);
1146
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("testfloat", 1.0f);
1147
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("testdouble", 1.0);
1148 1 }
1149 },
1150 1 { "int32", [&](){
1151
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool", true);
1152
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint64", 2);
1153
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("testfloat", 2.0f);
1154
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("testdouble", 2.0);
1155 1 }
1156 },
1157 1 { "int64", [&](){
1158
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool", true);
1159
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint32", 2);
1160
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("testfloat", 2.0f);
1161
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("testdouble", 2.0);
1162 1 }
1163 },
1164 1 { "float", [&](){
1165
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool", true);
1166
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint32", 1);
1167
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint64", 1);
1168
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("testdouble", double(1.1f));
1169 1 }
1170 },
1171 1 { "double", [&](){
1172
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<bool>("testbool", true);
1173
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("testint32", 1);
1174
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("testint64", 1);
1175
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("testfloat", float(1.1));
1176 1 }
1177 }
1178
6/14
✓ 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.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
12 };
1179
1180
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 for (const auto& expc : expected) {
1181
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 mHarness.reset();
1182
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 expc.second.operator()();
1183
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 this->execute("assign_implicit_scalar." + expc.first + ".ax");
1184 }
1185 1 }
1186
1187
1188 void
1189 1 TestAssign::implicitContainerAssignment()
1190 {
1191 5 auto generate = [this](const auto& source, const auto& target) {
1192
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 5 times.
18 for (const auto& t1 : source) {
1193
1/2
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
13 std::string code = "_T1_ local = _l1_;\n";
1194
2/4
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
13 unittest_util::replace(code, "_T1_", t1.first);
1195
4/8
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 13 times.
✗ Branch 11 not taken.
26 unittest_util::replace(code, "_l1_", t1.second.at("_l1_"));
1196
1197
2/2
✓ Branch 0 taken 35 times.
✓ Branch 1 taken 13 times.
48 for (const auto& t2 : target) {
1198
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 22 times.
35 if (t1.first == t2.first) continue;
1199
1/2
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
22 std::string tmp = "_T2_@_A1_ = local;";
1200
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.
44 unittest_util::replace(tmp, "_A1_", "test" + t2.first);
1201
2/4
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 22 times.
✗ Branch 5 not taken.
22 unittest_util::replace(tmp, "_T2_", t2.first);
1202
1/2
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
44 code += tmp + "\n";
1203 }
1204
1205
3/6
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
26 this->registerTest(code, "assign_implicit_container." + t1.first + ".ax");
1206 }
1207 5 };
1208
1209 // source -> dest
1210 1 generate(vec2, vec2);
1211 1 generate(vec3, vec3);
1212 1 generate(vec4, vec4);
1213 1 generate(mat3, mat3);
1214 1 generate(mat4, mat4);
1215
1216 // test name is the source type in use. source -> dest
1217 const std::map<std::string, std::function<void()>> expected = {
1218 1 { "vec2i", [&]() {
1219
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::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(1.0f,2.0f));
1220
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::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(1.0,2.0));
1221 1 }
1222 },
1223 1 { "vec2f", [&]() {
1224
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::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(1,2));
1225
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::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(double(1.1f),double(2.3f)));
1226 1 }
1227 },
1228 1 { "vec2d", [&]() {
1229
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::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(1,2));
1230
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::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(float(1.1),float(2.3)));
1231 1 }
1232 },
1233 1 { "vec3i", [&]() {
1234
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::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(1.0f,2.0f,3.0f));
1235
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(1.0,2.0,3.0));
1236 1 }
1237 },
1238 1 { "vec3f", [&]() {
1239
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::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(1,2,4));
1240
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(double(1.1f),double(2.3f),double(4.3f)));
1241 1 }
1242 },
1243 1 { "vec3d", [&]() {
1244
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::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(1,2,4));
1245
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::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(float(1.1),float(2.3),float(4.3)));
1246 1 }
1247 },
1248 1 { "vec4i", [&]() {
1249
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::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(1.0f,2.0f,3.0f,4.0f));
1250
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(1.0,2.0,3.0,4.0));
1251 1 }
1252 },
1253 1 { "vec4f", [&]() {
1254
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::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(1,2,4,5));
1255
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(double(1.1f),double(2.3f),double(4.3f),double(5.4f)));
1256 1 }
1257 },
1258 1 { "vec4d", [&]() {
1259
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::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(1,2,4,5));
1260
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::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(float(1.1),float(2.3),float(4.3),float(5.4)));
1261 1 }
1262 },
1263 { "mat3f",
1264
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>>("testmat3d",
1265 1 openvdb::math::Mat3<double>(
1266 double(1.1f),double(2.3f),double(4.3f),
1267 double(5.4f),double(6.7f),double(7.8f),
1268 double(9.1f),double(4.5f),double(8.2f)));
1269 1 }
1270 },
1271 { "mat3d",
1272
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>>("testmat3f",
1273 1 openvdb::math::Mat3<float>(
1274 float(1.1),float(2.3),float(4.3),
1275 float(5.4),float(6.7),float(7.8),
1276 float(9.1),float(4.5),float(8.2)));
1277 1 }
1278 },
1279 { "mat4f",
1280
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>>("testmat4d",
1281 1 openvdb::math::Mat4<double>(
1282 double(1.1f),double(2.3f),double(4.3f),double(5.4f),
1283 double(6.7f),double(7.8f),double(9.1f),double(4.5f),
1284 double(8.2f),double(3.3f),double(2.9f),double(5.9f),
1285 double(0.1f),double(0.3f),double(5.1f),double(1.9f)));
1286 1 }
1287 },
1288 { "mat4d",
1289
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>>("testmat4f",
1290 1 openvdb::math::Mat4<float>(
1291 float(1.1),float(2.3),float(4.3),float(5.4),
1292 float(6.7),float(7.8),float(9.1),float(4.5),
1293 float(8.2),float(3.3),float(2.9),float(5.9),
1294 float(0.1),float(0.3),float(5.1),float(1.9)));
1295 1 }
1296 }
1297
14/30
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✓ Branch 34 taken 1 times.
✗ Branch 35 not taken.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✗ Branch 40 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 43 not taken.
✗ Branch 44 not taken.
28 };
1298
1299
2/2
✓ Branch 0 taken 13 times.
✓ Branch 1 taken 1 times.
14 for (const auto& expc : expected) {
1300
1/2
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
13 mHarness.reset();
1301
1/2
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
13 expc.second.operator()();
1302
3/6
✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
26 this->execute("assign_implicit_container." + expc.first + ".ax");
1303 }
1304 1 }
1305
1306
1307 void
1308 1 TestAssign::implicitContainerScalarAssignment()
1309 {
1310 2 auto generate = [this](const auto& source, const auto& targets) {
1311
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
7 for (const auto& t1 : source) {
1312
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 std::string code = "_T1_ local = _l1_;\n";
1313
2/4
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
5 unittest_util::replace(code, "_T1_", t1.first);
1314
4/8
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 5 times.
✗ Branch 11 not taken.
10 unittest_util::replace(code, "_l1_", t1.second.at("_l1_"));
1315
1316
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 5 times.
30 for (const auto& target : targets) {
1317
2/2
✓ Branch 0 taken 65 times.
✓ Branch 1 taken 25 times.
90 for (const auto& t2 : *target) {
1318
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 65 times.
65 if (t1.first == t2.first) continue;
1319
1/2
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
65 std::string tmp = "_T2_@_A1_ = local;";
1320
3/6
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 65 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 65 times.
✗ Branch 8 not taken.
130 unittest_util::replace(tmp, "_A1_", "test" + t2.first);
1321
2/4
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 65 times.
✗ Branch 5 not taken.
65 unittest_util::replace(tmp, "_T2_", t2.first);
1322
1/2
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
130 code += tmp + "\n";
1323 }
1324 }
1325
1326
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 this->registerTest(code, "assign_implicit_container_scalar." + t1.first + ".ax");
1327 }
1328 2 };
1329
1330
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 generate(integral, std::vector<decltype(integral)*>{ &vec2, &vec3, &vec4, &mat3, &mat4 });
1331
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 generate(floating, std::vector<decltype(integral)*>{ &vec2, &vec3, &vec4, &mat3, &mat4 });
1332
1333 auto symmetric3 = [](auto val) -> openvdb::math::Mat3<decltype(val)> {
1334 openvdb::math::Mat3<decltype(val)> mat;
1335 mat.setZero();
1336 10 mat(0,0) = val;
1337 10 mat(1,1) = val;
1338
10/20
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
10 mat(2,2) = val;
1339 return mat;
1340 };
1341
1342 auto symmetric4 = [](auto val) -> openvdb::math::Mat4<decltype(val)> {
1343 openvdb::math::Mat4<decltype(val)> mat;
1344 mat.setZero();
1345 10 mat(0,0) = val;
1346 10 mat(1,1) = val;
1347 10 mat(2,2) = val;
1348
10/20
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 1 times.
✗ Branch 29 not taken.
10 mat(3,3) = val;
1349 return mat;
1350 };
1351
1352 const std::map<std::string, std::function<void()>> expected = {
1353 1 { "bool", [&]() {
1354
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::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(1,1));
1355
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::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(1.0f,1.0f));
1356
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::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(1.0,1.0));
1357
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::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(1,1,1));
1358
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::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(1.0f,1.0f,1.0f));
1359
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(1.0,1.0,1.0));
1360
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::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(1,1,1,1));
1361
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::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(1.0f,1.0f,1.0f,1.0f));
1362
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(1.0,1.0,1.0,1.0));
1363
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>>("testmat3f", symmetric3(1.0f));
1364
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>>("testmat3d", symmetric3(1.0));
1365
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>>("testmat4f", symmetric4(1.0f));
1366
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>>("testmat4d", symmetric4(1.0));
1367 1 }
1368 },
1369 1 { "int32", [&](){
1370
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::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(2,2));
1371
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::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(2.0,2.0));
1372
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::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(2.0f,2.0f));
1373
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::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(2,2,2));
1374
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(2.0,2.0,2.0));
1375
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::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(2.0f,2.0f,2.0f));
1376
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::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(2,2,2,2));
1377
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(2.0,2.0,2.0,2.0));
1378
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::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(2.0f,2.0f,2.0f,2.0f));
1379
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>>("testmat3f", symmetric3(2.0f));
1380
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>>("testmat3d", symmetric3(2.0));
1381
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>>("testmat4f", symmetric4(2.0f));
1382
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>>("testmat4d", symmetric4(2.0));
1383 1 }
1384 },
1385 1 { "int64", [&](){
1386
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::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(2,2));
1387
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::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(2.0,2.0));
1388
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::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(2.0f,2.0f));
1389
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::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(2,2,2));
1390
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(2.0,2.0,2.0));
1391
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::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(2.0f,2.0f,2.0f));
1392
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::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(2,2,2,2));
1393
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(2.0,2.0,2.0,2.0));
1394
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::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(2.0f,2.0f,2.0f,2.0f));
1395
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>>("testmat3f", symmetric3(2.0f));
1396
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>>("testmat3d", symmetric3(2.0));
1397
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>>("testmat4f", symmetric4(2.0f));
1398
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>>("testmat4d", symmetric4(2.0));
1399 1 }
1400 },
1401 1 { "float", [&](){
1402
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::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(1,1));
1403
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::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(double(1.1f),double(1.1f)));
1404
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::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(1.1f,1.1f));
1405
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::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(1,1,1));
1406
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(double(1.1f),double(1.1f),double(1.1f)));
1407
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::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(1.1f,1.1f,1.1f));
1408
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::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(1,1,1,1));
1409
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(double(1.1f),double(1.1f),double(1.1f),double(1.1f)));
1410
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::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(1.1f,1.1f,1.1f,1.1f));
1411
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>>("testmat3f", symmetric3(1.1f));
1412
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>>("testmat3d", symmetric3(double(1.1f)));
1413
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>>("testmat4f", symmetric4(1.1f));
1414
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>>("testmat4d", symmetric4(double(1.1f)));
1415 1 }
1416 },
1417 1 { "double", [&](){
1418
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::Vec2<int32_t>>("testvec2i", openvdb::math::Vec2<int32_t>(1,1));
1419
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::Vec2<double>>("testvec2d", openvdb::math::Vec2<double>(1.1,1.1));
1420
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::Vec2<float>>("testvec2f", openvdb::math::Vec2<float>(float(1.1),float(1.1)));
1421
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::Vec3<int32_t>>("testvec3i", openvdb::math::Vec3<int32_t>(1,1,1));
1422
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec3<double>>("testvec3d", openvdb::math::Vec3<double>(1.1,1.1,1.1));
1423
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::Vec3<float>>("testvec3f", openvdb::math::Vec3<float>(float(1.1),float(1.1),float(1.1)));
1424
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::Vec4<int32_t>>("testvec4i", openvdb::math::Vec4<int32_t>(1,1,1,1));
1425
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("testvec4d", openvdb::math::Vec4<double>(1.1,1.1,1.1,1.1));
1426
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::Vec4<float>>("testvec4f", openvdb::math::Vec4<float>(float(1.1),float(1.1),float(1.1),float(1.1)));
1427
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>>("testmat3f", symmetric3(float(1.1)));
1428
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>>("testmat3d", symmetric3(1.1));
1429
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>>("testmat4f", symmetric4(float(1.1)));
1430
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>>("testmat4d", symmetric4(1.1));
1431 1 }
1432 }
1433
6/14
✓ 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.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
7 };
1434
1435
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
6 for (const auto& expc : expected) {
1436
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 mHarness.reset();
1437
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
5 expc.second.operator()();
1438
3/6
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 5 times.
✗ Branch 8 not taken.
10 this->execute("assign_implicit_container_scalar." + expc.first + ".ax");
1439 }
1440 1 }
1441
1442
1443 void
1444 1 TestAssign::scopedAssign()
1445 {
1446 1 const std::string code = R"(
1447 float var = 30.0f;
1448
1449 {
1450 float var = 3.0f;
1451 }
1452 {
1453 float var = 1.0f;
1454 float@test2 = var;
1455 {
1456 float var = -10.0f;
1457 float@test3 = var;
1458 }
1459 {
1460 float@test7 = var;
1461 }
1462 }
1463 {
1464 float var = -100.0f;
1465 }
1466 {
1467 float var = 50.0f;
1468 {
1469 float var = -15.0f;
1470 float@test4 = var;
1471 }
1472 {
1473 float var = -10.0f;
1474 }
1475 {
1476 float@test5 = var;
1477 }
1478
1479 float@test6 = var;
1480 }
1481
1482 float@test1 = var;
1483 )";
1484
1485
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->registerTest(code, "assign_scoped.float.ax");
1486
1487
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 const auto names = unittest_util::nameSequence("test", 7);
1488
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttributes<float>(names, {30.0f, 1.0f, -10.0f, -15.0f, 50.0f, 50.0f, 1.0f});
1489
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 this->execute("assign_scoped.float.ax");
1490
1491
6/12
✓ 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.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
1 CPPUNIT_ASSERT(mHarness.mLogger.hasWarning());
1492 1 }
1493
1494