GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestInt32Metadata.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 15 15 100.0%
Functions: 1 1 100.0%
Branches: 17 118 14.4%

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
7 #include <gtest/gtest.h>
8
9 1 class TestInt32Metadata : public ::testing::Test
10 {
11 };
12
13
14
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestInt32Metadata, test)
15 {
16 using namespace openvdb;
17
18
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m(new Int32Metadata(123));
19
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m2 = m->copy();
20
21
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<Int32Metadata*>(m.get()) != 0);
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<Int32Metadata*>(m2.get()) != 0);
23
24
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("int32") == 0);
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(m2->typeName().compare("int32") == 0);
26
27
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 Int32Metadata *s = dynamic_cast<Int32Metadata*>(m.get());
28
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() == 123);
29
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 s->value() = 456;
30 EXPECT_TRUE(s->value() == 456);
31
32
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 m2->copy(*s);
33
34
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 s = dynamic_cast<Int32Metadata*>(m2.get());
35
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() == 456);
36 1 }
37