Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright Contributors to the OpenVDB Project | ||
2 | // SPDX-License-Identifier: MPL-2.0 | ||
3 | |||
4 | #include "TestHarness.h" | ||
5 | |||
6 | #include <cppunit/extensions/HelperMacros.h> | ||
7 | |||
8 | using namespace openvdb::points; | ||
9 | |||
10 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
|
3 | class TestTernary : 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(TestTernary); |
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(testTernary); |
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(testTernaryVoid); |
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(testTernaryErrors); |
17 |
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(); |
18 | |||
19 | void testTernary(); | ||
20 | void testTernaryVoid(); | ||
21 | void testTernaryErrors(); | ||
22 | }; | ||
23 | |||
24 | CPPUNIT_TEST_SUITE_REGISTRATION(TestTernary); | ||
25 | |||
26 | void | ||
27 | 1 | TestTernary::testTernary() | |
28 | { | ||
29 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<bool>("ternary_test1", true); |
30 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<bool>("ternary_test2", true); |
31 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test3", 3); |
32 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test4", 1); |
33 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test5", 2); |
34 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<float>("ternary_test6", 10.f); |
35 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | mHarness.addAttribute<double>("ternary_test7", 0.75); |
36 |
3/6✓ 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.
|
2 | mHarness.addAttribute<openvdb::Vec3i>("ternary_test8", openvdb::Vec3i(1,2,3)); |
37 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<openvdb::Vec3d>("ternary_test9", openvdb::Vec3f(4.5,5.5,6.5)); |
38 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test10", 1); |
39 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test11", 123); |
40 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test12", 2); |
41 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test13", 2); |
42 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<int>("ternary_test14", 123); |
43 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<float>("ternary_test15", 2.f); |
44 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
2 | mHarness.addAttribute<float>("ternary_test16", 1.5f); |
45 |
3/6✓ 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.
|
2 | mHarness.addAttribute<openvdb::Vec3i>("ternary_test17", openvdb::Vec3i(1,2,3)); |
46 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<openvdb::Vec3i>("ternary_test18", openvdb::Vec3i(4,5,6)); |
47 |
3/6✓ 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.
|
2 | mHarness.addAttribute<std::string>("ternary_test19", "foo"); |
48 |
3/6✓ 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.
|
2 | mHarness.addAttribute<std::string>("ternary_test20", "foo"); |
49 |
4/8✓ 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 11 taken 1 times.
✗ Branch 12 not taken.
|
2 | mHarness.addAttribute<std::string>("ternary_test21", "bar"); |
50 |
3/6✓ 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.
|
2 | mHarness.addAttribute<openvdb::Vec3f>("ternary_test22", openvdb::Vec3f(1.5f,1.5f,1.5f)); |
51 |
3/6✓ 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.
|
2 | mHarness.addAttribute<openvdb::Vec3f>("ternary_test23", openvdb::Vec3f(1.6f,1.6f,1.6f)); |
52 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<double>>("ternary_test24", |
53 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::math::Mat3<double>(1.8,0.0,0.0, |
54 | 0.0,1.8,0.0, | ||
55 | 0.0,0.0,1.8)); | ||
56 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat3<double>>("ternary_test25", |
57 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::math::Mat3<double>(1.9,0.0,0.0, |
58 | 0.0,1.9,0.0, | ||
59 | 0.0,0.0,1.9)); | ||
60 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<double>>("ternary_test26", |
61 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::math::Mat4<double>(1.8,0.0,0.0,0.0, |
62 | 0.0,1.8,0.0,0.0, | ||
63 | 0.0,0.0,1.8,0.0, | ||
64 | 0.0,0.0,0.0,1.8)); | ||
65 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::math::Mat4<double>>("ternary_test27", |
66 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::math::Mat4<double>(1.9,0.0,0.0,0.0, |
67 | 0.0,1.9,0.0,0.0, | ||
68 | 0.0,0.0,1.9,0.0, | ||
69 | 0.0,0.0,0.0,1.9)); | ||
70 |
3/6✓ 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.
|
2 | mHarness.addAttribute<openvdb::Vec3f>("ternary_test28", openvdb::Vec3f(1.76f,1.76f,1.76f)); |
71 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | mHarness.addAttribute<openvdb::Vec3f>("ternary_test29", openvdb::Vec3f(1.76f,1.76f,1.76f)); |
72 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<float>("ternary_test30", openvdb::Vec3f(1.3f,1.3f,1.3f).length()); |
73 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<float>("ternary_test31", openvdb::Vec3f(1.3f,1.3f,1.3f).length()); |
74 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<float>("ternary_test32", openvdb::Vec3f(1.5f,2.5f,3.5f).length()); |
75 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | mHarness.addAttribute<float>("ternary_test33", openvdb::Vec3f(1.5f,2.5f,3.5f).length()); |
76 | |||
77 |
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/ternary/ternary"); |
78 | |||
79 |
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(); |
80 | 1 | } | |
81 | |||
82 | void | ||
83 | 1 | TestTernary::testTernaryVoid() | |
84 | { | ||
85 | 1 | mHarness.testVolumes(false); | |
86 |
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 13 taken 1 times.
✓ Branch 14 taken 1 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
2 | mHarness.addExpectedGroups({"notdead"}, {true}); |
87 |
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/ternary/ternaryVoid"); |
88 | |||
89 |
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(); |
90 | 1 | } | |
91 | |||
92 | void | ||
93 | 1 | TestTernary::testTernaryErrors() | |
94 | { | ||
95 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | const bool success = mHarness.executeCode("test/snippets/ternary/ternaryErrors"); |
96 |
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 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
|
1 | CPPUNIT_ASSERT(!success); |
97 | 1 | } | |
98 | |||
99 |