GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestMat4Metadata.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 33 33 100.0%
Functions: 2 2 100.0%
Branches: 38 272 14.0%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include <openvdb/Exceptions.h>
5 #include <openvdb/Metadata.h>
6 #include <gtest/gtest.h>
7
8 2 class TestMat4Metadata : public ::testing::Test
9 {
10 };
11
12
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 TEST_F(TestMat4Metadata, testMat4s)
13 {
14 using namespace openvdb;
15
16
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m(new Mat4SMetadata(openvdb::math::Mat4s(1.0f, 1.0f, 1.0f, 1.0f,
17 1.0f, 1.0f, 1.0f, 1.0f,
18 1.0f, 1.0f, 1.0f, 1.0f,
19
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 1.0f, 1.0f, 1.0f, 1.0f)));
20
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m3 = m->copy();
21
22
2/18
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_TRUE(dynamic_cast<Mat4SMetadata*>( m.get()) != 0);
23
2/18
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_TRUE(dynamic_cast<Mat4SMetadata*>(m3.get()) != 0);
24
25
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
1 EXPECT_TRUE( m->typeName().compare("mat4s") == 0);
26
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
1 EXPECT_TRUE(m3->typeName().compare("mat4s") == 0);
27
28
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 Mat4SMetadata *s = dynamic_cast<Mat4SMetadata*>(m.get());
29
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(s->value() == openvdb::math::Mat4s(1.0f, 1.0f, 1.0f, 1.0f,
30 1.0f, 1.0f, 1.0f, 1.0f,
31 1.0f, 1.0f, 1.0f, 1.0f,
32 1.0f, 1.0f, 1.0f, 1.0f));
33 1 s->value() = openvdb::math::Mat4s(3.0f, 3.0f, 3.0f, 3.0f,
34 3.0f, 3.0f, 3.0f, 3.0f,
35 3.0f, 3.0f, 3.0f, 3.0f,
36 3.0f, 3.0f, 3.0f, 3.0f);
37
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(s->value() == openvdb::math::Mat4s(3.0f, 3.0f, 3.0f, 3.0f,
38 3.0f, 3.0f, 3.0f, 3.0f,
39 3.0f, 3.0f, 3.0f, 3.0f,
40 3.0f, 3.0f, 3.0f, 3.0f));
41
42
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 m3->copy(*s);
43
44
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 s = dynamic_cast<Mat4SMetadata*>(m3.get());
45
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(s->value() == openvdb::math::Mat4s(3.0f, 3.0f, 3.0f, 3.0f,
46 3.0f, 3.0f, 3.0f, 3.0f,
47 3.0f, 3.0f, 3.0f, 3.0f,
48 3.0f, 3.0f, 3.0f, 3.0f));
49 1 }
50
51
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
2 TEST_F(TestMat4Metadata, testMat4d)
52 {
53 using namespace openvdb;
54
55
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m(new Mat4DMetadata(openvdb::math::Mat4d(1.0, 1.0, 1.0, 1.0,
56 1.0, 1.0, 1.0, 1.0,
57 1.0, 1.0, 1.0, 1.0,
58
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 1.0, 1.0, 1.0, 1.0)));
59
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m3 = m->copy();
60
61
2/18
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_TRUE(dynamic_cast<Mat4DMetadata*>( m.get()) != 0);
62
2/18
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
1 EXPECT_TRUE(dynamic_cast<Mat4DMetadata*>(m3.get()) != 0);
63
64
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
1 EXPECT_TRUE( m->typeName().compare("mat4d") == 0);
65
2/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
1 EXPECT_TRUE(m3->typeName().compare("mat4d") == 0);
66
67
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 Mat4DMetadata *s = dynamic_cast<Mat4DMetadata*>(m.get());
68
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(s->value() == openvdb::math::Mat4d(1.0, 1.0, 1.0, 1.0,
69 1.0, 1.0, 1.0, 1.0,
70 1.0, 1.0, 1.0, 1.0,
71 1.0, 1.0, 1.0, 1.0));
72 1 s->value() = openvdb::math::Mat4d(3.0, 3.0, 3.0, 3.0,
73 3.0, 3.0, 3.0, 3.0,
74 3.0, 3.0, 3.0, 3.0,
75 3.0, 3.0, 3.0, 3.0);
76
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(s->value() == openvdb::math::Mat4d(3.0, 3.0, 3.0, 3.0,
77 3.0, 3.0, 3.0, 3.0,
78 3.0, 3.0, 3.0, 3.0,
79 3.0, 3.0, 3.0, 3.0));
80
81
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 m3->copy(*s);
82
83
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 s = dynamic_cast<Mat4DMetadata*>(m3.get());
84
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(s->value() == openvdb::math::Mat4d(3.0, 3.0, 3.0, 3.0,
85 3.0, 3.0, 3.0, 3.0,
86 3.0, 3.0, 3.0, 3.0,
87 3.0, 3.0, 3.0, 3.0));
88 1 }
89