GCC Code Coverage Report


Directory: ./
File: openvdb_ax/openvdb_ax/test/integration/TestUnary.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 33 33 100.0%
Functions: 6 6 100.0%
Branches: 117 234 50.0%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include "TestHarness.h"
5 #include "../util.h"
6
7 #include <cppunit/extensions/HelperMacros.h>
8
9
10
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
4 class TestUnary : public unittest_util::AXTestCase
11 {
12 public:
13
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(TestUnary);
14
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(testBitwiseNot);
15
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(testNegate);
16
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(testNot);
17
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(testUnaryVector);
18
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();
19
20 void testBitwiseNot();
21 void testNegate();
22 void testNot();
23 void testUnaryVector();
24 };
25
26 CPPUNIT_TEST_SUITE_REGISTRATION(TestUnary);
27
28 void
29 1 TestUnary::testBitwiseNot()
30 {
31
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 2 times.
✓ Branch 17 taken 1 times.
✓ Branch 19 taken 1 times.
✗ Branch 20 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
3 mHarness.addAttributes<int>({"int_test", "int_test2"}, {-9, -8});
32
33
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.executeCode("test/snippets/unary/unaryBitwiseNot");
34
35
7/14
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
2 AXTESTS_STANDARD_ASSERT();
36 1 }
37
38 void
39 1 TestUnary::testNegate()
40 {
41
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<int>("int_test", -3);
42
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 mHarness.addAttribute<float>("float_test", -5.5f);
43
44
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.executeCode("test/snippets/unary/unaryNegate");
45
46
7/14
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
2 AXTESTS_STANDARD_ASSERT();
47 1 }
48
49 void
50 1 TestUnary::testNot()
51 {
52
7/14
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 2 times.
✓ Branch 17 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
3 mHarness.addAttributes<bool>({"bool_test", "bool_test2"}, {false, true});
53
54
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.executeCode("test/snippets/unary/unaryNot");
55
56
7/14
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
2 AXTESTS_STANDARD_ASSERT();
57 1 }
58
59 void
60 1 TestUnary::testUnaryVector()
61 {
62 // vec3
63
64 mHarness.addAttributes<openvdb::math::Vec3<int32_t>>
65
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
2 (unittest_util::nameSequence("v3i", 4), {
66 openvdb::math::Vec3<int32_t>(0, 1,-1),
67 openvdb::math::Vec3<int32_t>(0,-1, 1),
68 openvdb::math::Vec3<int32_t>(-1,-2,0),
69 openvdb::math::Vec3<int32_t>(1, 0, 0)
70 });
71
72 mHarness.addAttributes<openvdb::math::Vec3<float>>
73
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
2 (unittest_util::nameSequence("v3f", 2), {
74 openvdb::math::Vec3<float>(0.0f, 1.1f,-1.1f),
75 openvdb::math::Vec3<float>(0.0f,-1.1f, 1.1f),
76 });
77
78 mHarness.addAttributes<openvdb::math::Vec3<double>>
79
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
2 (unittest_util::nameSequence("v3d", 2), {
80 openvdb::math::Vec3<double>(0.0, 1.1,-1.1),
81 openvdb::math::Vec3<double>(0.0,-1.1, 1.1),
82 });
83
84 // vec4
85
86 mHarness.addAttributes<openvdb::math::Vec4<int32_t>>
87
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
2 (unittest_util::nameSequence("v4i", 4), {
88 openvdb::math::Vec4<int32_t>(0, 1,-1, 2),
89 openvdb::math::Vec4<int32_t>(0,-1, 1, -2),
90 openvdb::math::Vec4<int32_t>(-1,-2,0,-3),
91 openvdb::math::Vec4<int32_t>(1, 0, 0, 0)
92 });
93
94 mHarness.addAttributes<openvdb::math::Vec4<float>>
95
6/12
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
2 (unittest_util::nameSequence("v4f", 2), {
96 openvdb::math::Vec4<float>(0.0f, 1.1f,-1.1f, 2.1f),
97 openvdb::math::Vec4<float>(0.0f,-1.1f, 1.1f, -2.1f)
98 });
99
100 mHarness.addAttributes<openvdb::math::Vec4<double>>
101
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("v4d", 2), {
102 openvdb::math::Vec4<double>(0.0, 1.1,-1.1, 2.1),
103 openvdb::math::Vec4<double>(0.0,-1.1, 1.1, -2.1)
104 });
105
106
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 mHarness.executeCode("test/snippets/unary/unaryVector");
107
108
7/14
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
2 AXTESTS_STANDARD_ASSERT();
109 1 }
110
111