GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestDoubleMetadata.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 16 16 100.0%
Functions: 1 1 100.0%
Branches: 20 132 15.2%

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 TestDoubleMetadata : public ::testing::Test
10 {
11 };
12
13
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestDoubleMetadata, test)
14 {
15 using namespace openvdb;
16
17
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m(new DoubleMetadata(1.23));
18
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 Metadata::Ptr m2 = m->copy();
19
20
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<DoubleMetadata*>(m.get()) != 0);
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<DoubleMetadata*>(m2.get()) != 0);
22
23
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("double") == 0);
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(m2->typeName().compare("double") == 0);
25
26
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 DoubleMetadata *s = dynamic_cast<DoubleMetadata*>(m.get());
27 //EXPECT_TRUE(s->value() == 1.23);
28
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(1.23,s->value(),0);
29 1 s->value() = 4.56;
30 //EXPECT_TRUE(s->value() == 4.56);
31
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(4.56,s->value(),0);
32
33
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 m2->copy(*s);
34
35
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 s = dynamic_cast<DoubleMetadata*>(m2.get());
36 //EXPECT_TRUE(s->value() == 4.56);
37
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_NEAR(4.56,s->value(),0);
38 1 }
39