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 | |||
10 | 1 | class TestFloatMetadata : public ::testing::Test | |
11 | { | ||
12 | }; | ||
13 | |||
14 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | TEST_F(TestFloatMetadata, test) |
15 | { | ||
16 | using namespace openvdb; | ||
17 | |||
18 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | Metadata::Ptr m(new FloatMetadata(1.0)); |
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<FloatMetadata*>(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<FloatMetadata*>(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("float") == 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("float") == 0); |
26 | |||
27 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | FloatMetadata *s = dynamic_cast<FloatMetadata*>(m.get()); |
28 | //EXPECT_TRUE(s->value() == 1.0); | ||
29 |
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.0f,s->value(),0); |
30 | 1 | s->value() = 2.0; | |
31 | //EXPECT_TRUE(s->value() == 2.0); | ||
32 |
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(2.0f,s->value(),0); |
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<FloatMetadata*>(m2.get()); |
36 | //EXPECT_TRUE(s->value() == 2.0); | ||
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(2.0f,s->value(),0); |
38 | 1 | } | |
39 |