GCC Code Coverage Report


Directory: ./
File: openvdb_ax/openvdb_ax/test/integration/TestStandardFunctions.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 567 572 99.1%
Functions: 65 65 100.0%
Branches: 1131 2277 49.7%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include "TestHarness.h"
5
6 #include "../util.h"
7
8 #include <openvdb_ax/compiler/CustomData.h>
9 #include <openvdb_ax/math/OpenSimplexNoise.h>
10 #include <openvdb_ax/compiler/PointExecutable.h>
11 #include <openvdb_ax/compiler/VolumeExecutable.h>
12
13 #include <openvdb/points/PointConversion.h>
14 #include <openvdb/util/CpuTimer.h>
15
16 #include <cppunit/extensions/HelperMacros.h>
17
18 #include <iostream>
19 #include <cstdlib>
20 #include <cmath>
21 #include <functional>
22 #include <random>
23
24 using namespace openvdb::points;
25 using namespace openvdb::ax;
26
27
2/4
✓ Branch 1 taken 59 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 59 times.
✗ Branch 4 not taken.
59 class TestStandardFunctions : public unittest_util::AXTestCase
28 {
29 public:
30 #ifdef PROFILE
31 void setUp() override {
32 // if PROFILE, generate more data for each test
33 mHarness.reset(/*ppv*/8, openvdb::CoordBBox({0,0,0},{50,50,50}));
34 }
35 #endif
36
37
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(TestStandardFunctions);
38
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(abs);
39
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(acos);
40
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(adjoint);
41
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(argsort);
42
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(asin);
43
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(atan);
44
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(atan2);
45
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(atof);
46
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(atoi);
47
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(cbrt);
48
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(clamp);
49
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(cofactor);
50
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(cosh);
51
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(cross);
52
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(curlsimplexnoise);
53
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(degrees);
54
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(determinant);
55
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(diag);
56
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(dot);
57
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(euclideanmod);
58
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(external);
59
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(fit);
60
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(floormod);
61
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(hash);
62
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(hsvtorgb);
63
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(identity3);
64
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(identity4);
65
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(intrinsic);
66
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(inverse);
67
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(isfinite);
68
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(isinf);
69
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(isnan);
70
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(length);
71
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(lengthsq);
72
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(lerp);
73
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(max);
74
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(min);
75
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(normalize);
76
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(polardecompose);
77
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(postscale);
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(pow);
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(prescale);
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(pretransform);
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(print);
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(radians);
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(rand);
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(rand32);
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(rgbtohsv);
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(sign);
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(signbit);
88
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(simplexnoise);
89
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(sinh);
90
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(sort);
91
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(tan);
92
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(tanh);
93
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(trace);
94
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(transform);
95
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(transpose);
96
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(truncatemod);
97
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();
98
99 void abs();
100 void acos();
101 void adjoint();
102 void argsort();
103 void asin();
104 void atan();
105 void atan2();
106 void atof();
107 void atoi();
108 void cbrt();
109 void clamp();
110 void cofactor();
111 void cosh();
112 void cross();
113 void curlsimplexnoise();
114 void degrees();
115 void determinant();
116 void diag();
117 void dot();
118 void euclideanmod();
119 void external();
120 void fit();
121 void floormod();
122 void hash();
123 void hsvtorgb();
124 void identity3();
125 void identity4();
126 void intrinsic();
127 void inverse();
128 void isfinite();
129 void isinf();
130 void isnan();
131 void length();
132 void lengthsq();
133 void lerp();
134 void max();
135 void min();
136 void normalize();
137 void polardecompose();
138 void postscale();
139 void pow();
140 void prescale();
141 void pretransform();
142 void print();
143 void radians();
144 void rand();
145 void rand32();
146 void rgbtohsv();
147 void sign();
148 void signbit();
149 void simplexnoise();
150 void sinh();
151 void sort();
152 void tan();
153 void tanh();
154 void trace();
155 void transform();
156 void transpose();
157 void truncatemod();
158 };
159
160 CPPUNIT_TEST_SUITE_REGISTRATION(TestStandardFunctions);
161
162 58 inline void testFunctionOptions(unittest_util::AXTestHarness& harness,
163 const std::string& name,
164 CustomData::Ptr data = CustomData::create())
165 {
166 58 const std::string file = "test/snippets/function/" + name;
167
168 #ifdef PROFILE
169 struct Timer : public openvdb::util::CpuTimer {} timer;
170
171 const std::string code = unittest_util::loadText(file);
172 timer.start(std::string("\n") + name + std::string(": Parsing"));
173 const ast::Tree::Ptr syntaxTree = ast::parse(code.c_str());
174 timer.stop();
175
176 CPPUNIT_ASSERT_MESSAGE(syntaxTree, "Invalid AX passed to testFunctionOptions.");
177
178 // @warning the first execution can take longer due to some llvm startup
179 // so if you're profiling a single function be aware of this.
180 // This also profiles execution AND compilation.
181
182 auto profile = [&syntaxTree, &timer, &data]
183 (const openvdb::ax::CompilerOptions& opts,
184 std::vector<openvdb::points::PointDataGrid::Ptr>& points,
185 openvdb::GridPtrVec& volumes,
186 const bool doubleCompile = true)
187 {
188 if (!points.empty())
189 {
190 openvdb::ax::Compiler compiler(opts);
191 if (doubleCompile) {
192 compiler.compile<PointExecutable>(*syntaxTree, data);
193 }
194 {
195 timer.start(" Points/Compilation ");
196 PointExecutable::Ptr executable =
197 compiler.compile<PointExecutable>(*syntaxTree, data);
198 timer.stop();
199 timer.start(" Points/Execution ");
200 executable->execute(*points.front());
201 timer.stop();
202 }
203 }
204
205 if (!volumes.empty())
206 {
207 openvdb::ax::Compiler compiler(opts);
208 if (doubleCompile) {
209 compiler.compile<VolumeExecutable>(*syntaxTree, data);
210 }
211 {
212 timer.start(" Volumes/Compilation ");
213 VolumeExecutable::Ptr executable =
214 compiler.compile<VolumeExecutable>(*syntaxTree, data);
215 timer.stop();
216 timer.start(" Volumes/Execution ");
217 executable->execute(volumes);
218 timer.stop();
219 }
220 }
221 };
222 #endif
223
224 58 openvdb::ax::CompilerOptions opts;
225 58 opts.mFunctionOptions.mConstantFoldCBindings = false;
226 58 opts.mFunctionOptions.mPrioritiseIR = false;
227 #ifdef PROFILE
228 std::cerr << " C Bindings" << std::endl;
229 profile(opts, harness.mInputPointGrids, harness.mInputVolumeGrids);
230 #else
231 58 harness.mOpts = opts;
232 harness.mCustomData = data;
233
1/2
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
58 bool success = harness.executeCode(file);
234
8/16
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 58 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 58 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 58 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 58 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 58 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 58 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 58 times.
✗ Branch 23 not taken.
116 CPPUNIT_ASSERT_MESSAGE("error thrown during test: " + file + "\n" + harness.errors(),
235 success);
236
8/16
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 58 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 58 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 58 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 58 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 58 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 58 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 58 times.
✗ Branch 23 not taken.
116 AXTESTS_STANDARD_ASSERT_HARNESS(harness);
237 #endif
238
239
1/2
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
58 harness.resetInputsToZero();
240
241 opts.mFunctionOptions.mConstantFoldCBindings = false;
242 58 opts.mFunctionOptions.mPrioritiseIR = true;
243 #ifdef PROFILE
244 std::cerr << " IR Functions " << std::endl;
245 profile(opts, harness.mInputPointGrids, harness.mInputVolumeGrids);
246 #else
247 58 harness.mOpts = opts;
248 harness.mCustomData = data;
249
1/2
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
58 success = harness.executeCode(file);
250
8/16
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 58 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 58 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 58 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 58 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 58 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 58 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 58 times.
✗ Branch 23 not taken.
116 CPPUNIT_ASSERT_MESSAGE("error thrown during test: " + file + "\n" + harness.errors(),
251 success);
252
8/16
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 58 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 58 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 58 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 58 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 58 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 58 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 58 times.
✗ Branch 23 not taken.
116 AXTESTS_STANDARD_ASSERT_HARNESS(harness);
253 #endif
254
255
1/2
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
58 harness.resetInputsToZero();
256
257 58 opts.mFunctionOptions.mConstantFoldCBindings = true;
258 58 opts.mFunctionOptions.mPrioritiseIR = false;
259 #ifdef PROFILE
260 std::cerr << " C Folding " << std::endl;
261 profile(opts, harness.mInputPointGrids, harness.mInputVolumeGrids);
262 #else
263 58 harness.mOpts = opts;
264 harness.mCustomData = data;
265
1/2
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
58 success = harness.executeCode(file);
266
8/16
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 58 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 58 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 58 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 58 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 58 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 58 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 58 times.
✗ Branch 23 not taken.
116 CPPUNIT_ASSERT_MESSAGE("error thrown during test: " + file + "\n" + harness.errors(),
267 success);
268
8/16
✓ Branch 1 taken 58 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 58 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 58 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 58 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 58 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 58 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 58 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 58 times.
✗ Branch 23 not taken.
116 AXTESTS_STANDARD_ASSERT_HARNESS(harness);
269 #endif
270 58 }
271
272 void
273 1 TestStandardFunctions::abs()
274 {
275
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 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("test", 3), {
276 std::abs(-3), std::abs(3), std::abs(0)
277 });
278
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int64_t>("test4", std::llabs(-2147483649LL));
279
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test5", std::abs(0.3f));
280
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test6", std::abs(-0.3f));
281
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test7", std::abs(1.79769e+308));
282
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test8", std::abs(-1.79769e+308));
283
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "abs");
284 1 }
285
286 void
287 1 TestStandardFunctions::acos()
288 {
289 1 volatile double arg = 0.5;
290 1 volatile float argf = 0.5f;
291
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::acos(arg));
292
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::acos(argf));
293
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "acos");
294 1 }
295
296 void
297 1 TestStandardFunctions::adjoint()
298 {
299 const openvdb::math::Mat3<double> inputd(
300 1.0, -1.0, 0.0,
301 2.0, 2.0, 0.0,
302 0.0, 0.0, -1.0);
303
304 1 openvdb::math::Mat3<double> add = inputd.adjoint();
305
306 const openvdb::math::Mat3<float> inputf(
307 1.0f, -1.0f, 0.0f,
308 2.0f, 2.0f, 0.0f,
309 0.0f, 0.0f, -1.0f);
310
311 1 openvdb::math::Mat3<float> adf = inputf.adjoint();
312
313
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<double>>("test1", add);
314
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<float>>("test2", adf);
315
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "adjoint");
316 1 }
317
318 void
319
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TestStandardFunctions::argsort()
320 {
321 // const openvdb::Vec3d input3d(1.0, -1.0, 0.0);
322 // const openvdb::Vec3f input3f(1.0f, -1.0f, 0.0f);
323 // const openvdb::Vec3i input3i(1, -1, 0);
324
325 // const openvdb::Vec4d input4d(1.0, -1.0, 0.0, 5.0);
326 // const openvdb::Vec4f input4f(1.0f, -1.0f, 0.0f, 5.0f);
327 // const openvdb::Vec4i input4i(1, -1, 0, 5);
328
329 const openvdb::Vec3i arg3d(1,2,0);
330 const openvdb::Vec3i arg3f(1,2,0);
331 const openvdb::Vec3i arg3i(1,2,0);
332
333 const openvdb::Vec4i arg4d(1,2,0,3);
334 const openvdb::Vec4i arg4f(1,2,0,3);
335 const openvdb::Vec4i arg4i(1,2,0,3);
336
337
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec3i>("test1", arg3d);
338
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec3i>("test2", arg3f);
339
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec3i>("test3", arg3i);
340
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec4i>("test4", arg4d);
341
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec4i>("test5", arg4f);
342
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec4i>("test6", arg4i);
343
344
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "argsort");
345 1 }
346
347
348 void
349 1 TestStandardFunctions::asin()
350 {
351
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::asin(-0.5));
352
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::asin(-0.5f));
353
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "asin");
354 1 }
355
356 void
357 1 TestStandardFunctions::atan()
358 {
359
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::atan(1.0));
360
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::atan(1.0f));
361
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "atan");
362 1 }
363
364 void
365 1 TestStandardFunctions::atan2()
366 {
367
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::atan2(1.0, 1.0));
368
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::atan2(1.0f, 1.0f));
369
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "atan2");
370 1 }
371
372 void
373 1 TestStandardFunctions::atoi()
374 {
375 const std::vector<int32_t> values {
376 std::atoi(""),
377 std::atoi("-0"),
378 std::atoi("+0"),
379 std::atoi("-1"),
380 std::atoi("1"),
381 std::atoi("1s"),
382 std::atoi("1s"),
383 std::atoi(" 1"),
384 std::atoi("1s1"),
385 std::atoi("1 1"),
386 std::atoi("11"),
387 std::atoi("2147483647"), // int max
388 std::atoi("-2147483648")
389 1 };
390
391
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("test", 13), values);
392
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "atoi");
393 1 }
394
395 void
396 1 TestStandardFunctions::atof()
397 {
398 const std::vector<double> values {
399 std::atof(""),
400 std::atof("-0.0"),
401 std::atof("+0.0"),
402 std::atof("-1.1"),
403 std::atof("1.5"),
404 std::atof("1.s9"),
405 std::atof("1s.9"),
406 std::atof(" 1.6"),
407 std::atof("1.5s1"),
408 std::atof("1. 1.3"),
409 std::atof("11.11"),
410 std::atof("1.79769e+308"),
411 std::atof("2.22507e-308")
412 1 };
413
414
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("test", 13), values);
415
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "atof");
416 1 }
417
418 void
419 1 TestStandardFunctions::cbrt()
420 {
421 1 volatile double arg = 729.0;
422 1 volatile float argf = 729.0f;
423
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::cbrt(arg));
424
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::cbrt(argf));
425
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "cbrt");
426 1 }
427
428 void
429 1 TestStandardFunctions::clamp()
430 {
431
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 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("double_test", 3), {-1.5, 0.0, 1.5});
432
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "clamp");
433 1 }
434
435 void
436 1 TestStandardFunctions::cofactor()
437 {
438 const openvdb::math::Mat3<double> inputd(
439 1.0, -1.0, 0.0,
440 2.0, 2.0, 0.0,
441 0.0, 0.0, -1.0);
442
443 1 openvdb::math::Mat3<double> cd = inputd.cofactor();
444
445 const openvdb::math::Mat3<float> inputf(
446 1.0f, -1.0f, 0.0f,
447 2.0f, 2.0f, 0.0f,
448 0.0f, 0.0f, -1.0f);
449
450 1 openvdb::math::Mat3<float> cf = inputf.cofactor();
451
452
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<double>>("test1", cd);
453
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<float>>("test2", cf);
454
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "cofactor");
455 1 }
456
457 void
458 1 TestStandardFunctions::cosh()
459 {
460 1 volatile float arg = 1.0f;
461
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::cosh(1.0));
462
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::cosh(arg));
463
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "cosh");
464 1 }
465
466 void
467 1 TestStandardFunctions::cross()
468 {
469 const openvdb::Vec3d ad(1.0,2.2,3.4), bd(4.1,5.3,6.2);
470 const openvdb::Vec3f af(1.0f,2.2f,3.4f), bf(4.1f,5.3f,6.2f);
471 const openvdb::Vec3i ai(1,2,3), bi(4,5,6);
472
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 mHarness.addAttribute<openvdb::Vec3d>("test1", ad.cross(bd));
473
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.addAttribute<openvdb::Vec3f>("test2", af.cross(bf));
474
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec3i>("test3", ai.cross(bi));
475
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "cross");
476 1 }
477
478 void
479 1 TestStandardFunctions::curlsimplexnoise()
480 {
481 struct Local {
482 12 static inline double noise(double x, double y, double z) {
483 12 const OSN::OSNoise gen;
484 12 const double result = gen.eval<double>(x, y, z);
485 12 return (result + 1.0) * 0.5;
486 }
487 };
488
489 double result[3];
490 1 openvdb::ax::math::curlnoise<Local>(&result, 4.3, 5.7, -6.2);
491
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const openvdb::Vec3d expected(result[0], result[1], result[2]);
492
493 mHarness.addAttributes<openvdb::Vec3d>
494
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 14 taken 1 times.
✗ Branch 15 not taken.
1 (unittest_util::nameSequence("test", 2), {expected,expected});
495
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "curlsimplexnoise");
496 1 }
497
498 void
499 1 TestStandardFunctions::degrees()
500 {
501
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", 1.5708 * (180.0 / openvdb::math::pi<double>()));
502
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", -1.1344f * (180.0f / openvdb::math::pi<float>()));
503
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "degrees");
504 1 }
505
506 void
507 1 TestStandardFunctions::determinant()
508 {
509
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("det3_float", 600.0f);
510
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("det3_double", 600.0);
511
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("det4_float", 24.0f);
512
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("det4_double", 2400.0);
513
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "determinant");
514 1 }
515
516 void
517 1 TestStandardFunctions::diag()
518 {
519 mHarness.addAttribute<openvdb::math::Mat3<double>>
520
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 ("test1", openvdb::math::Mat3<double>(-1,0,0, 0,-2,0, 0,0,-3));
521 mHarness.addAttribute<openvdb::math::Mat3<float>>
522
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 ("test2", openvdb::math::Mat3<float>(-1,0,0, 0,-2,0, 0,0,-3));
523 mHarness.addAttribute<openvdb::math::Mat4<double>>
524
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 ("test3", openvdb::math::Mat4<double>(-1,0,0,0, 0,-2,0,0, 0,0,-3,0, 0,0,0,-4));
525 mHarness.addAttribute<openvdb::math::Mat4<float>>
526
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 ("test4", openvdb::math::Mat4<float>(-1,0,0,0, 0,-2,0,0, 0,0,-3,0, 0,0,0,-4));
527
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 mHarness.addAttribute<openvdb::math::Vec3<double>>("test5", openvdb::math::Vec3<float>(-1,-5,-9));
528
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.addAttribute<openvdb::math::Vec3<float>>("test6", openvdb::math::Vec3<float>(-1,-5,-9));
529
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 mHarness.addAttribute<openvdb::math::Vec4<double>>("test7", openvdb::math::Vec4<double>(-1,-6,-11,-16));
530
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>>("test8", openvdb::math::Vec4<float>(-1,-6,-11,-16));
531
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "diag");
532 1 }
533
534 void
535 1 TestStandardFunctions::dot()
536 {
537 const openvdb::Vec3d ad(1.0,2.2,3.4), bd(4.1,5.3,6.2);
538 const openvdb::Vec3f af(1.0f,2.2f,3.4f), bf(4.1f,5.3f,6.2f);
539 const openvdb::Vec3i ai(1,2,3), bi(4,5,6);
540
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", ad.dot(bd));
541
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", af.dot(bf));
542
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int32_t>("test3", ai.dot(bi));
543
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "dot");
544 1 }
545
546 void
547 1 TestStandardFunctions::euclideanmod()
548 {
549 static auto emod = [](auto D, auto d) -> auto {
550 using ValueType = decltype(D);
551 return ValueType(D - d * (d < 0 ? std::ceil(D/double(d)) : std::floor(D/double(d))));
552 };
553
554 // @note these also test that these match % op
555 1 const std::vector<int32_t> ivalues{ emod(7, 5), emod(-7, 5), emod(7,-5), emod(-7,-5) };
556
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 const std::vector<float> fvalues{ emod(7.2f, 5.7f), emod(-7.2f, 5.7f), emod(7.2f, -5.7f), emod(-7.2f, -5.7f) };
557
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 const std::vector<double> dvalues{ emod(7.2, 5.7), emod(-7.2, 5.7), emod(7.2, -5.7), emod(-7.2, -5.7) };
558
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("itest", 4), ivalues);
559
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<float>(unittest_util::nameSequence("ftest", 4), fvalues);
560
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("dtest", 4), dvalues);
561
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "euclideanmod");
562 1 }
563
564 void
565 1 TestStandardFunctions::external()
566 {
567
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 mHarness.addAttribute<float>("foo", 2.0f);
568
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.addAttribute<openvdb::Vec3f>("v", openvdb::Vec3f(1.0f, 2.0f, 3.0f));
569
570 using FloatMeta = openvdb::TypedMetadata<float>;
571 using VectorFloatMeta = openvdb::TypedMetadata<openvdb::math::Vec3<float>>;
572
573 FloatMeta customFloatData(2.0f);
574 1 VectorFloatMeta customVecData(openvdb::math::Vec3<float>(1.0f, 2.0f, 3.0f));
575
576 // test initialising the data before compile
577
578
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 CustomData::Ptr data = CustomData::create();
579
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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
3 data->insertData("float1", customFloatData.copy());
580
4/8
✓ 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.
3 data->insertData("vector1", customVecData.copy());
581
582
3/6
✓ 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.
2 testFunctionOptions(mHarness, "external", data);
583
584
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.reset();
585
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 mHarness.addAttribute<float>("foo", 2.0f);
586
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
2 mHarness.addAttribute<openvdb::Vec3f>("v", openvdb::Vec3f(1.0f, 2.0f, 3.0f));
587
588 // test post compilation
589
590 data->reset();
591
592
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 const std::string code = unittest_util::loadText("test/snippets/function/external");
593
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 Compiler compiler;
594
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 PointExecutable::Ptr pointExecutable = compiler.compile<PointExecutable>(code, data);
595
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
2 VolumeExecutable::Ptr volumeExecutable = compiler.compile<VolumeExecutable>(code, data);
596
597
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 data->insertData("float1", customFloatData.copy());
598
599 VectorFloatMeta::Ptr customTypedVecData =
600
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 openvdb::StaticPtrCast<VectorFloatMeta>(customVecData.copy());
601
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.
3 data->insertData<VectorFloatMeta>("vector1", customTypedVecData);
602
603
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
3 for (auto& grid : mHarness.mInputPointGrids) {
604
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 pointExecutable->execute(*grid);
605 }
606
607
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 volumeExecutable->execute(mHarness.mInputSparseVolumeGrids);
608
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 volumeExecutable->execute(mHarness.mInputDenseVolumeGrids);
609
610
8/16
✓ 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.
2 AXTESTS_STANDARD_ASSERT()
611 1 }
612
613 void
614 1 TestStandardFunctions::fit()
615 {
616 std::vector<double> values{23.0, -23.0, -25.0, -15.0, -15.0, -18.0, -24.0, 0.0, 10.0,
617 1 -5.0, 0.0, -1.0, 4.5, 4.5, 4.5, 4.5, 4.5};
618
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("double_test", 17), values);
619
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "fit");
620 1 }
621
622 void
623 1 TestStandardFunctions::floormod()
624 {
625 auto axmod = [](auto D, auto d) -> auto {
626 6 auto r = std::fmod(D, d);
627
5/10
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
5 if ((r > 0 && d < 0) || (r < 0 && d > 0)) r = r+d;
628 return r;
629 };
630
631 // @note these also test that these match % op
632
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 const std::vector<int32_t> ivalues{ 2,2, 3,3, -3,-3, -2,-2 };
633 const std::vector<float> fvalues{ axmod(7.2f,5.7f),axmod(7.2f,5.7f),
634 axmod(-7.2f,5.7f),axmod(-7.2f,5.7f),
635 axmod(7.2f,-5.7f),axmod(7.2f,-5.7f),
636 axmod(-7.2f,-5.7f),axmod(-7.2f,-5.7f)
637
7/16
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 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 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
5 };
638 const std::vector<double> dvalues{ axmod(7.2,5.7),axmod(7.2,5.7),
639 axmod(-7.2,5.7),axmod(-7.2,5.7),
640 axmod(7.2,-5.7),axmod(7.2,-5.7),
641 axmod(-7.2,-5.7),axmod(-7.2,-5.7)
642
7/16
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 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 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
5 };
643
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("itest", 8), ivalues);
644
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<float>(unittest_util::nameSequence("ftest", 8), fvalues);
645
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("dtest", 8), dvalues);
646
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "floormod");
647 1 }
648
649 void
650 1 TestStandardFunctions::hash()
651 {
652 const std::vector<int64_t> values{
653
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 static_cast<int64_t>(std::hash<std::string>{}("")),
654 1 static_cast<int64_t>(std::hash<std::string>{}("0")),
655 1 static_cast<int64_t>(std::hash<std::string>{}("abc")),
656 1 static_cast<int64_t>(std::hash<std::string>{}("123")),
657
4/8
✓ 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.
4 };
658
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<int64_t>(unittest_util::nameSequence("test", 4), values);
659
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "hash");
660 1 }
661
662 void
663 1 TestStandardFunctions::hsvtorgb()
664 {
665 auto axmod = [](auto D, auto d) -> auto {
666 8 auto r = std::fmod(D, d);
667
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
8 if ((r > 0 && d < 0) || (r < 0 && d > 0)) r = r+d;
668 return r;
669 };
670
671 // HSV to RGB conversion. Taken from OpenEXR's ImathColorAlgo
672 // @note AX adds flooredmod of input hue to wrap to [0,1] domain
673 // @note AX also clamp saturation to [0,1]
674
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
8 auto convert = [&](const openvdb::Vec3d& hsv) {
675 double hue = hsv.x();
676
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 6 times.
8 double sat = hsv.y();
677 double val = hsv.z();
678 openvdb::Vec3d rgb(0.0);
679
680 // additions
681 hue = axmod(hue, 1.0);
682
2/2
✓ Branch 0 taken 5 times.
✓ Branch 1 taken 3 times.
8 sat = std::max(0.0, sat);
683
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
8 sat = std::min(1.0, sat);
684 //
685
686
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 if (hue == 1) hue = 0;
687 8 else hue *= 6;
688
689 8 int i = int(std::floor(hue));
690 8 double f = hue - i;
691 8 double p = val * (1 - sat);
692 8 double q = val * (1 - (sat * f));
693 8 double t = val * (1 - (sat * (1 - f)));
694
695
5/7
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
✗ Branch 6 not taken.
8 switch (i) {
696 case 0:
697 3 rgb[0] = val; rgb[1] = t; rgb[2] = p;
698 3 break;
699 case 1:
700 1 rgb[0] = q; rgb[1] = val; rgb[2] = p;
701 1 break;
702 case 2:
703 rgb[0] = p; rgb[1] = val; rgb[2] = t;
704 break;
705 case 3:
706 1 rgb[0] = p; rgb[1] = q; rgb[2] = val;
707 1 break;
708 case 4:
709 1 rgb[0] = t; rgb[1] = p; rgb[2] = val;
710 1 break;
711 case 5:
712 2 rgb[0] = val; rgb[1] = p; rgb[2] = q;
713 2 break;
714 }
715
716 8 return rgb;
717 1 };
718
719 const std::vector<openvdb::Vec3d> values{
720 1 convert({0,0,0}),
721 1 convert({1,1,1}),
722 1 convert({5.8,1,1}),
723 1 convert({-0.1,-0.5,10}),
724 1 convert({-5.1,10.5,-5}),
725 1 convert({-7,-11.5,5}),
726 1 convert({0.5,0.5,0.5}),
727 1 convert({0.3,1.0,10.0})
728 1 };
729
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<openvdb::Vec3d>(unittest_util::nameSequence("test", 8), values);
730
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "hsvtorgb");
731 1 }
732
733 void
734 1 TestStandardFunctions::identity3()
735 {
736
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 mHarness.addAttribute<openvdb::Mat3d>("test", openvdb::Mat3d::identity());
737
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "identity3");
738 1 }
739
740 void
741 1 TestStandardFunctions::identity4()
742 {
743
2/4
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
1 mHarness.addAttribute<openvdb::Mat4d>("test", openvdb::Mat4d::identity());
744
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "identity4");
745 1 }
746
747 void
748 1 TestStandardFunctions::intrinsic()
749 {
750
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 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("dtest", 12), {
751 std::sqrt(9.0),
752 std::cos(0.0),
753 std::sin(0.0),
754 std::log(1.0),
755 std::log10(1.0),
756 std::log2(2.0),
757 std::exp(0.0),
758 std::exp2(4.0),
759 std::fabs(-10.321),
760 std::floor(2194.213),
761 std::ceil(2194.213),
762 std::round(0.5)
763 });
764
765
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 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<float>(unittest_util::nameSequence("ftest", 12), {
766 std::sqrt(9.0f),
767 std::cos(0.0f),
768 std::sin(0.0f),
769 std::log(1.0f),
770 std::log10(1.0f),
771 std::log2(2.0f),
772 std::exp(0.0f),
773 std::exp2(4.0f),
774 std::fabs(-10.321f),
775 std::floor(2194.213f),
776 std::ceil(2194.213f),
777 std::round(0.5f)
778 });
779
780
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "intrinsic");
781 1 }
782
783 void
784 1 TestStandardFunctions::inverse()
785 {
786 const openvdb::math::Mat3<double> inputd(
787 1.0, -1.0, 0.0,
788 2.0, 2.0, 0.0,
789 0.0, 0.0, -1.0);
790
791 const openvdb::math::Mat3<double> singulard(
792 1.0, 2.0, 3.0,
793 4.0, 5.0, 6.0,
794 7.0, 8.0, 9.0);
795
796 const openvdb::math::Mat3<float> inputf(
797 1.0f, -1.0f, 0.0f,
798 2.0f, 2.0f, 0.0f,
799 0.0f, 0.0f, -1.0f);
800
801 const openvdb::math::Mat3<float> singularf(
802 1.0f, 2.0f, 3.0f,
803 4.0f, 5.0f, 6.0f,
804 7.0f, 8.0f, 9.0f);
805
806 1 openvdb::math::Mat3<double> invd = inputd.inverse();
807 1 openvdb::math::Mat3<float> invf = inputf.inverse();
808
809
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<double>>("test1", invd);
810
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<float>>("test2", invf);
811
812 // inverse(singular) returns the original matrix
813
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<double>>("test3", singulard);
814
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::math::Mat3<float>>("test4", singularf);
815
816
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "inverse");
817 1 }
818
819 void
820 1 TestStandardFunctions::isfinite()
821 {
822
29/58
✓ 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 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 1 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 1 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 1 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 24 times.
✓ Branch 83 taken 1 times.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
25 mHarness.addAttributes<bool>(
823 {"test1","test2","test3","test4","test5","test6","test7","test8","test9","test10", "test11","test12",
824 "test13","test14","test15","test16","test17","test18","test19","test20", "test21","test22", "test23","test24"},
825 {true, true, true, true, true, true, true, true, true, true, true, true,
826 false, false, false, false, false, false, false, false, false, false, false, false});
827
828
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "isfinite");
829 1 }
830
831 void
832 1 TestStandardFunctions::isinf()
833 {
834
29/58
✓ 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 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 1 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 1 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 1 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 24 times.
✓ Branch 83 taken 1 times.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
25 mHarness.addAttributes<bool>(
835 {"test1","test2","test3","test4","test5","test6","test7","test8","test9","test10", "test11","test12",
836 "test13","test14","test15","test16","test17","test18","test19","test20", "test21","test22", "test23","test24"},
837 {false, false, false, false, false, false, false, false, false, false, false, false,
838 true, true, true, true, true, true, true, true, true, true, true, true});
839
840
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "isinf");
841 1 }
842
843 void
844 1 TestStandardFunctions::isnan()
845 {
846
29/58
✓ 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 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✓ Branch 64 taken 1 times.
✗ Branch 65 not taken.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✓ Branch 70 taken 1 times.
✗ Branch 71 not taken.
✓ Branch 73 taken 1 times.
✗ Branch 74 not taken.
✓ Branch 76 taken 1 times.
✗ Branch 77 not taken.
✓ Branch 79 taken 1 times.
✗ Branch 80 not taken.
✓ Branch 82 taken 24 times.
✓ Branch 83 taken 1 times.
✗ Branch 87 not taken.
✗ Branch 88 not taken.
25 mHarness.addAttributes<bool>(
847 {"test1","test2","test3","test4","test5","test6","test7","test8","test9","test10", "test11","test12",
848 "test13","test14","test15","test16","test17","test18","test19","test20", "test21","test22", "test23","test24"},
849 {false, false, false, false, false, false, false, false, false, false, false, false,
850 true, true, true, true, true, true, true, true, true, true, true, true});
851
852
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "isnan");
853 1 }
854
855
856 void
857 1 TestStandardFunctions::length()
858 {
859
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test1", openvdb::Vec2d(2.2, 3.3).length());
860
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test2", openvdb::Vec2f(2.2f, 3.3f).length());
861
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test3", std::sqrt(double(openvdb::Vec2i(2, 3).lengthSqr())));
862
863
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test4", openvdb::Vec3d(2.2, 3.3, 6.6).length());
864
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test5", openvdb::Vec3f(2.2f, 3.3f, 6.6f).length());
865
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 mHarness.addAttribute("test6", std::sqrt(double(openvdb::Vec3i(2, 3, 6).lengthSqr())));
866
867
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
2 mHarness.addAttribute("test7", openvdb::Vec4d(2.2, 3.3, 6.6, 7.7).length());
868
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 mHarness.addAttribute("test8", openvdb::Vec4f(2.2f, 3.3f, 6.6f, 7.7f).length());
869
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test9", std::sqrt(double(openvdb::Vec4i(2, 3, 6, 7).lengthSqr())));
870
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "length");
871 1 }
872
873 void
874 1 TestStandardFunctions::lengthsq()
875 {
876
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test1", openvdb::Vec2d(2.2, 3.3).lengthSqr());
877
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test2", openvdb::Vec2f(2.2f, 3.3f).lengthSqr());
878
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test3", openvdb::Vec2i(2, 3).lengthSqr());
879
880
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test4", openvdb::Vec3d(2.2, 3.3, 6.6).lengthSqr());
881
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test5", openvdb::Vec3f(2.2f, 3.3f, 6.6f).lengthSqr());
882
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test6", openvdb::Vec3i(2, 3, 6).lengthSqr());
883
884
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test7", openvdb::Vec4d(2.2, 3.3, 6.6, 7.7).lengthSqr());
885
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test8", openvdb::Vec4f(2.2f, 3.3f, 6.6f, 7.7f).lengthSqr());
886
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test9", openvdb::Vec4i(2, 3, 6, 7).lengthSqr());
887
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "lengthsq");
888 1 }
889
890 void
891 1 TestStandardFunctions::lerp()
892 {
893
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 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("test", 9),
894 {-1.1, 1.0000001, 1.0000001, -1.0000001, 1.1, -1.1, 6.0, 21.0, -19.0});
895
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test10", 6.0f);
896
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "lerp");
897 1 }
898
899 void
900 1 TestStandardFunctions::max()
901 {
902
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test1", std::max(-1.5, 1.5));
903
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test2", std::max(-1.5f, 1.5f));
904
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test3", std::max(-1, 1));
905
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "max");
906 1 }
907
908 void
909 1 TestStandardFunctions::min()
910 {
911
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test1", std::min(-1.5, 1.5));
912
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test2", std::min(-1.5f, 1.5f));
913
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test3", std::min(-1, 1));
914
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "min");
915 1 }
916
917 void
918 1 TestStandardFunctions::normalize()
919 {
920 openvdb::Vec3f expected3f(1.f, 2.f, 3.f);
921 openvdb::Vec3d expected3d(1., 2., 3.);
922 openvdb::Vec3d expected3i(1, 2, 3);
923
924 openvdb::Vec4f expected4f(1.f, 2.f, 3.f, 4.f);
925 openvdb::Vec4d expected4d(1., 2., 3., 4.);
926 openvdb::Vec4d expected4i(1, 2, 3, 4);
927
928 1 expected3f.normalize();
929 1 expected3d.normalize();
930 1 expected3i.normalize();
931 1 expected4f.normalize();
932 1 expected4d.normalize();
933 1 expected4i.normalize();
934
935
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute("test1", expected3f);
936
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test2", expected3d);
937
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test3", expected3i);
938
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute("test4", expected4f);
939
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test5", expected4d);
940
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute("test6", expected4i);
941
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "normalize");
942 1 }
943
944 void
945 1 TestStandardFunctions::polardecompose()
946 {
947 // See snippet/polardecompose for details
948 const openvdb::Mat3d composite(
949 1.41421456236949, 0.0, -5.09116882455613,
950 0.0, 3.3, 0.0,
951 -1.41421356237670, 0.0, -5.09116882453015);
952
953 openvdb::Mat3d rot, symm;
954 1 openvdb::math::polarDecomposition(composite, rot, symm);
955
956
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Mat3d>("rotation", rot);
957
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Mat3d>("symm", symm);
958
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "polardecompose");
959 1 }
960
961 void
962 1 TestStandardFunctions::postscale()
963 {
964
965 mHarness.addAttributes<openvdb::math::Mat4<float>>
966
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 ({"mat1", "mat3", "mat5"}, {
967 openvdb::math::Mat4<float>(
968 10.0f, 22.0f, 36.0f, 4.0f,
969 50.0f, 66.0f, 84.0f, 8.0f,
970 90.0f, 110.0f,132.0f,12.0f,
971 130.0f,154.0f,180.0f,16.0f),
972 openvdb::math::Mat4<float>(
973 -1.0f, -4.0f, -9.0f, 4.0f,
974 -5.0f, -12.0f,-21.0f, 8.0f,
975 -9.0f, -20.0f,-33.0f,12.0f,
976 -13.0f,-28.0f,-45.0f,16.0f),
977 openvdb::math::Mat4<float>(
978 0.0f, 100.0f, 200.0f, 100.0f,
979 0.0f, 200.0f, 400.0f, 200.0f,
980 0.0f, 300.0f, 600.0f, 300.0f,
981 0.0f, 400.0f, 800.0f, 400.0f)
982 });
983
984 mHarness.addAttributes<openvdb::math::Mat4<double>>
985
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
4 ({"mat2", "mat4", "mat6"}, {
986 openvdb::math::Mat4<double>(
987 10.0, 22.0, 36.0, 4.0,
988 50.0, 66.0, 84.0, 8.0,
989 90.0, 110.0,132.0,12.0,
990 130.0,154.0,180.0,16.0),
991 openvdb::math::Mat4<double>(
992 -1.0, -4.0, -9.0, 4.0,
993 -5.0, -12.0,-21.0, 8.0,
994 -9.0, -20.0,-33.0,12.0,
995 -13.0,-28.0,-45.0,16.0),
996 openvdb::math::Mat4<double>(
997 0.0, 100.0, 200.0, 100.0,
998 0.0, 200.0, 400.0, 200.0,
999 0.0, 300.0, 600.0, 300.0,
1000 0.0, 400.0, 800.0, 400.0)
1001 });
1002
1003
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "postscale");
1004 1 }
1005
1006 void
1007 1 TestStandardFunctions::pow()
1008 {
1009
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 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<float>(unittest_util::nameSequence("float_test", 5),{
1010 1.0f,
1011 static_cast<float>(std::pow(3.0, -2.1)),
1012 std::pow(4.7f, -4.3f),
1013 static_cast<float>(std::pow(4.7f, 3)),
1014 0.00032f
1015 });
1016
1017
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int>("int_test1", static_cast<int>(std::pow(3, 5)));
1018
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "pow");
1019 1 }
1020
1021 void
1022 1 TestStandardFunctions::prescale()
1023 {
1024
1025 mHarness.addAttributes<openvdb::math::Mat4<float>>
1026
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 ({"mat1", "mat3", "mat5"}, {
1027 openvdb::math::Mat4<float>(
1028 10.0f, 20.0f, 30.0f, 40.0f,
1029 55.0f, 66.0f, 77.0f, 88.0f,
1030 108.0f, 120.0f,132.0f,144.0f,
1031 13.0f,14.0f,15.0f,16.0f),
1032 openvdb::math::Mat4<float>(
1033 -1.0f,-2.0f,-3.0f,-4.0f,
1034 -10.0f,-12.0f,-14.0f,-16.0f,
1035 -27.0f,-30.0f,-33.0f,-36.0f,
1036 13.0f,14.0f,15.0f,16.0f),
1037 openvdb::math::Mat4<float>(
1038 0.0f, 0.0f, 0.0f, 0.0f,
1039 200.0f, 200.0f, 200.0f, 200.0f,
1040 600.0f, 600.0f, 600.0f, 600.0f,
1041 400.0f, 400.0f, 400.0f, 400.0f)
1042 });
1043
1044 mHarness.addAttributes<openvdb::math::Mat4<double>>
1045
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
4 ({"mat2", "mat4", "mat6"}, {
1046 openvdb::math::Mat4<double>(
1047 10.0, 20.0, 30.0, 40.0,
1048 55.0, 66.0, 77.0, 88.0,
1049 108.0, 120.0,132.0,144.0,
1050 13.0,14.0,15.0,16.0),
1051 openvdb::math::Mat4<double>(
1052 -1.0,-2.0,-3.0,-4.0,
1053 -10.0,-12.0,-14.0,-16.0,
1054 -27.0,-30.0,-33.0,-36.0,
1055 13.0,14.0,15.0,16.0),
1056 openvdb::math::Mat4<double>(
1057 0.0, 0.0, 0.0, 0.0,
1058 200.0, 200.0, 200.0, 200.0,
1059 600.0, 600.0, 600.0, 600.0,
1060 400.0, 400.0, 400.0, 400.0)
1061 });
1062
1063
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "prescale");
1064 1 }
1065
1066 void
1067 1 TestStandardFunctions::pretransform()
1068 {
1069 mHarness.addAttributes<openvdb::math::Vec3<double>>
1070
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 ({"test1", "test3", "test7"}, {
1071 openvdb::math::Vec3<double>(14.0, 32.0, 50.0),
1072 openvdb::math::Vec3<double>(18.0, 46.0, 74.0),
1073 openvdb::math::Vec3<double>(18.0, 46.0, 74.0),
1074 });
1075
1076
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("test5",
1077
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<double>(30.0, 70.0, 110.0, 150.0));
1078
1079 mHarness.addAttributes<openvdb::math::Vec3<float>>
1080
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 ({"test2", "test4", "test8"}, {
1081 openvdb::math::Vec3<float>(14.0f, 32.0f, 50.0f),
1082 openvdb::math::Vec3<float>(18.0f, 46.0f, 74.0f),
1083 openvdb::math::Vec3<float>(18.0f, 46.0f, 74.0f),
1084 });
1085
1086
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>>("test6",
1087 1 openvdb::math::Vec4<float>(30.0f, 70.0f, 110.0f, 150.0f));
1088
1089
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "pretransform");
1090 1 }
1091
1092 void
1093 1 TestStandardFunctions::print()
1094 {
1095 openvdb::math::Transform::Ptr transform =
1096 1 openvdb::math::Transform::createLinearTransform();
1097 const std::vector<openvdb::Vec3d> single = {
1098 openvdb::Vec3d::zero()
1099
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 };
1100
1101 openvdb::points::PointDataGrid::Ptr grid =
1102 openvdb::points::createPointDataGrid
1103 <openvdb::points::NullCodec, openvdb::points::PointDataGrid>
1104
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 (single, *transform);
1105
1106
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 const std::string code = unittest_util::loadText("test/snippets/function/print");
1107
1108
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 openvdb::ax::Compiler::UniquePtr compiler = openvdb::ax::Compiler::create();
1109 openvdb::ax::PointExecutable::Ptr executable =
1110
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 compiler->compile<openvdb::ax::PointExecutable>(code);
1111
1112 std::streambuf* sbuf = std::cout.rdbuf();
1113
1114 try {
1115 // Redirect cout
1116
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 std::stringstream buffer;
1117
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::cout.rdbuf(buffer.rdbuf());
1118
1119
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 executable->execute(*grid);
1120 const std::string& result = buffer.str();
1121
1122
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 std::string expected = "a\n1\n2e-10\n";
1123
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 expected += openvdb::Vec4i(3,4,5,6).str() + "\n";
1124
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 expected += "bcd\n";
1125
1126
4/8
✓ 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.
1 CPPUNIT_ASSERT_EQUAL(expected, result);
1127 }
1128 catch (...) {
1129 std::cout.rdbuf(sbuf);
1130 throw;
1131 }
1132
1133
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::cout.rdbuf(sbuf);
1134 1 }
1135
1136 void
1137 1 TestStandardFunctions::radians()
1138 {
1139
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", 90.0 * (openvdb::math::pi<double>() / 180.0));
1140
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", -65.0f * (openvdb::math::pi<float>() / 180.0f ));
1141
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "radians");
1142 1 }
1143
1144 void
1145 1 TestStandardFunctions::rand()
1146 {
1147 std::mt19937_64 engine;
1148 std::uniform_real_distribution<double> uniform(0.0,1.0);
1149
1150 1 size_t hash = std::hash<double>()(2.0);
1151 1 engine.seed(hash);
1152
1153 const double expected1 = uniform(engine);
1154
1155 1 hash = std::hash<double>()(3.0);
1156 1 engine.seed(hash);
1157
1158 const double expected2 = uniform(engine);
1159 const double expected3 = uniform(engine);
1160
1161
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 4 times.
✓ Branch 23 taken 1 times.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 mHarness.addAttributes<double>({"test0", "test1", "test2", "test3"},
1162 {expected1, expected1, expected2, expected3});
1163
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "rand");
1164 1 }
1165
1166 void
1167 1 TestStandardFunctions::rand32()
1168 {
1169 auto hashToSeed = [](size_t hash) ->
1170 std::mt19937::result_type
1171 {
1172 unsigned int seed = 0;
1173 do {
1174 4 seed ^= (uint32_t) hash;
1175
4/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
4 } while (hash >>= sizeof(uint32_t) * 8);
1176 2 return std::mt19937::result_type(seed);
1177 };
1178
1179 std::mt19937 engine;
1180 std::uniform_real_distribution<double> uniform(0.0,1.0);
1181
1182 1 size_t hash = std::hash<double>()(2.0);
1183 1 engine.seed(hashToSeed(hash));
1184
1185 const double expected1 = uniform(engine);
1186
1187 1 hash = std::hash<double>()(3.0);
1188 1 engine.seed(hashToSeed(hash));
1189
1190 const double expected2 = uniform(engine);
1191 const double expected3 = uniform(engine);
1192
1193
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 4 times.
✓ Branch 23 taken 1 times.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 mHarness.addAttributes<double>({"test0", "test1", "test2", "test3"},
1194 {expected1, expected1, expected2, expected3});
1195
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "rand32");
1196 1 }
1197
1198 void
1199 1 TestStandardFunctions::rgbtohsv()
1200 {
1201 // RGB to HSV conversion. Taken from OpenEXR's ImathColorAlgo
1202
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 auto convert = [](const openvdb::Vec3d& rgb) {
1203 const double& x = rgb.x();
1204 const double& y = rgb.y();
1205 const double& z = rgb.z();
1206
1207
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 1 times.
4 double max = (x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z);
1208
4/6
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
4 double min = (x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z);
1209 4 double range = max - min;
1210 double val = max;
1211 double sat = 0;
1212 double hue = 0;
1213
1214
2/2
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
4 if (max != 0) sat = range / max;
1215
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
4 if (sat != 0)
1216 {
1217 double h;
1218
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (x == max) h = (y - z) / range;
1219
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
2 else if (y == max) h = 2 + (z - x) / range;
1220 1 else h = 4 + (x - y) / range;
1221 2 hue = h / 6.;
1222
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (hue < 0.) hue += 1.0;
1223 }
1224
1225 4 return openvdb::Vec3d(hue, sat, val);
1226 };
1227
1228 const std::vector<openvdb::Vec3d> values{
1229 1 convert({0,0,0}),
1230 1 convert({1,1,1}),
1231 1 convert({20.5,40.3,100.1}),
1232 1 convert({-10,1.3,0.25})
1233 1 };
1234
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<openvdb::Vec3d>(unittest_util::nameSequence("test", 4), values);
1235
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "rgbtohsv");
1236 1 }
1237
1238 void
1239 1 TestStandardFunctions::sign()
1240 {
1241
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 14 taken 1 times.
✗ Branch 15 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("test", 13),
1242 { 0,0,0,0,0,0,0, -1,-1,-1, 1,1,1 });
1243
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "sign");
1244 1 }
1245
1246 void
1247 1 TestStandardFunctions::signbit()
1248 {
1249
4/8
✓ 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.
1 mHarness.addAttributes<bool>(unittest_util::nameSequence("test", 5), {true,false,true,false,false});
1250
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "signbit");
1251 1 }
1252
1253 void
1254 1 TestStandardFunctions::simplexnoise()
1255 {
1256 1 const OSN::OSNoise noiseGenerator;
1257
1258 1 const double noise1 = noiseGenerator.eval<double>(1.0, 2.0, 3.0);
1259 1 const double noise2 = noiseGenerator.eval<double>(1.0, 2.0, 0.0);
1260 1 const double noise3 = noiseGenerator.eval<double>(1.0, 0.0, 0.0);
1261 1 const double noise4 = noiseGenerator.eval<double>(4.0, 14.0, 114.0);
1262
1263
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("noise1", (noise1 + 1.0) * 0.5);
1264
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("noise2", (noise2 + 1.0) * 0.5);
1265
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("noise3", (noise3 + 1.0) * 0.5);
1266
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("noise4", (noise4 + 1.0) * 0.5);
1267
1268
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "simplexnoise");
1269 1 }
1270
1271 void
1272 1 TestStandardFunctions::sinh()
1273 {
1274
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::sinh(1.0));
1275
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::sinh(1.0f));
1276
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "sinh");
1277 1 }
1278
1279 void
1280
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TestStandardFunctions::sort()
1281 {
1282 // const openvdb::Vec3d input3d(1.0, -1.0, 0.0);
1283 // const openvdb::Vec3f input3f(1.0f, -1.0f, 0.0f);
1284 // const openvdb::Vec3i input3i(1, -1, 0);
1285
1286 // const openvdb::Vec4d input4d(1.0, -1.0, 0.0, 5.0);
1287 // const openvdb::Vec4f input4f(1.0f, -1.0f, 0.0f, 5.0f);
1288 // const openvdb::Vec4i input4i(1, -1, 0, 5);
1289
1290 const openvdb::Vec3d sorted3d(-1.0,0.0,1.0);
1291 const openvdb::Vec3f sorted3f(-1.0f,0.0f,1.0f);
1292 const openvdb::Vec3i sorted3i(-1,0,1);
1293
1294 const openvdb::Vec4d sorted4d(-1.0,0.0,1.0,5.0);
1295 const openvdb::Vec4f sorted4f(-1.0f,0.0f,1.0f,5.0f);
1296 const openvdb::Vec4i sorted4i(-1,0,1,5);
1297
1298
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::Vec3d>("test1", sorted3d);
1299
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec3f>("test2", sorted3f);
1300
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec3i>("test3", sorted3i);
1301
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::Vec4d>("test4", sorted4d);
1302
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec4f>("test5", sorted4f);
1303
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute<openvdb::Vec4i>("test6", sorted4i);
1304
1305
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "sort");
1306 1 }
1307
1308 void
1309 1 TestStandardFunctions::tan()
1310 {
1311
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::tan(1.0));
1312
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::tan(1.0f));
1313
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "tan");
1314 1 }
1315
1316 void
1317 1 TestStandardFunctions::tanh()
1318 {
1319
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", std::tanh(1.0));
1320
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", std::tanh(1.0f));
1321
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "tanh");
1322 1 }
1323
1324 void
1325 1 TestStandardFunctions::trace()
1326 {
1327
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<double>("test1", 6.0);
1328
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("test2", 6.0f);
1329
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "trace");
1330 1 }
1331
1332 void
1333 1 TestStandardFunctions::truncatemod()
1334 {
1335 // @note these also test that these match % op
1336
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 const std::vector<int32_t> ivalues{ 2,-2,2,-2, };
1337
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 const std::vector<float> fvalues{ std::fmod(7.2f, 5.7f), std::fmod(-7.2f, 5.7f), std::fmod(7.2f, -5.7f), std::fmod(-7.2f, -5.7f) };
1338
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 const std::vector<double> dvalues{ std::fmod(7.2, 5.7), std::fmod(-7.2, 5.7), std::fmod(7.2, -5.7), std::fmod(-7.2, -5.7) };
1339
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<int32_t>(unittest_util::nameSequence("itest", 4), ivalues);
1340
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<float>(unittest_util::nameSequence("ftest", 4), fvalues);
1341
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
1 mHarness.addAttributes<double>(unittest_util::nameSequence("dtest", 4), dvalues);
1342
5/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 9 taken 1 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
4 testFunctionOptions(mHarness, "truncatemod");
1343 1 }
1344
1345 void
1346 1 TestStandardFunctions::transform()
1347 {
1348 mHarness.addAttributes<openvdb::math::Vec3<double>>
1349
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 ({"test1", "test3", "test7"}, {
1350 openvdb::math::Vec3<double>(30.0, 36.0, 42.0),
1351 openvdb::math::Vec3<double>(51.0, 58, 65.0),
1352 openvdb::math::Vec3<double>(51.0, 58, 65.0),
1353 });
1354
1355
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<openvdb::math::Vec4<double>>("test5",
1356
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Vec4<double>(90.0, 100.0, 110.0, 120.0));
1357
1358 mHarness.addAttributes<openvdb::math::Vec3<float>>
1359
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 3 times.
✓ Branch 20 taken 1 times.
✓ Branch 22 taken 1 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 1 times.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
5 ({"test2", "test4", "test8"}, {
1360 openvdb::math::Vec3<float>(30.0f, 36.0f, 42.0f),
1361 openvdb::math::Vec3<float>(51.0f, 58.0f, 65.0f),
1362 openvdb::math::Vec3<float>(51.0f, 58.0f, 65.0f),
1363 });
1364
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::Vec4<float>>("test6",
1366 1 openvdb::math::Vec4<float>(90.0f, 100.0f, 110.0f, 120.0f));
1367
1368
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "transform");
1369 1 }
1370
1371 void
1372 1 TestStandardFunctions::transpose()
1373 {
1374
1375
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute("test1",
1376
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Mat3<double>(
1377 1.0, 4.0, 7.0,
1378 2.0, 5.0, 8.0,
1379 3.0, 6.0, 9.0));
1380
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute("test2",
1381
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Mat3<float>(
1382 1.0f, 4.0f, 7.0f,
1383 2.0f, 5.0f, 8.0f,
1384 3.0f, 6.0f, 9.0f));
1385
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.addAttribute("test3",
1386
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::math::Mat4<double>(
1387 1.0, 5.0, 9.0,13.0,
1388 2.0, 6.0,10.0,14.0,
1389 3.0, 7.0,11.0,15.0,
1390 4.0, 8.0,12.0,16.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("test4",
1392 1 openvdb::math::Mat4<float>(
1393 1.0f, 5.0f, 9.0f,13.0f,
1394 2.0f, 6.0f,10.0f,14.0f,
1395 3.0f, 7.0f,11.0f,15.0f,
1396 4.0f, 8.0f,12.0f,16.0f));
1397
1398
3/6
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
4 testFunctionOptions(mHarness, "transpose");
1399 1 }
1400
1401