Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright Contributors to the OpenVDB Project | ||
2 | // SPDX-License-Identifier: MPL-2.0 | ||
3 | |||
4 | #include <iostream> | ||
5 | |||
6 | #include "util.h" | ||
7 | |||
8 | #include <openvdb_ax/compiler/CompilerOptions.h> | ||
9 | #include <openvdb_ax/codegen/Functions.h> | ||
10 | #include <openvdb_ax/codegen/FunctionRegistry.h> | ||
11 | #include <cppunit/extensions/HelperMacros.h> | ||
12 | |||
13 |
2/4✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
|
1 | class TestFunctionRegistry : public CppUnit::TestCase |
14 | { | ||
15 | public: | ||
16 | |||
17 |
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(TestFunctionRegistry); |
18 |
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(testCreateAllVerify); |
19 |
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(); |
20 | |||
21 | void testCreateAllVerify(); | ||
22 | }; | ||
23 | |||
24 | CPPUNIT_TEST_SUITE_REGISTRATION(TestFunctionRegistry); | ||
25 | |||
26 | void | ||
27 | 1 | TestFunctionRegistry::testCreateAllVerify() | |
28 | { | ||
29 | openvdb::ax::codegen::FunctionRegistry::UniquePtr reg = | ||
30 | 2 | openvdb::ax::codegen::createDefaultRegistry(); | |
31 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | openvdb::ax::FunctionOptions opts; |
32 | |||
33 | // check that no warnings are printed during registration | ||
34 | // @todo Replace this with a better logger once AX has one! | ||
35 | |||
36 | std::streambuf* sbuf = std::cerr.rdbuf(); | ||
37 | |||
38 | try { | ||
39 | // Redirect cerr | ||
40 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
2 | std::stringstream buffer; |
41 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | std::cerr.rdbuf(buffer.rdbuf()); |
42 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | reg->createAll(opts, true); |
43 | const std::string& result = buffer.str(); | ||
44 |
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.
|
2 | CPPUNIT_ASSERT_MESSAGE(result, result.empty()); |
45 | } | ||
46 | ✗ | catch (...) { | |
47 | ✗ | std::cerr.rdbuf(sbuf); | |
48 | ✗ | throw; | |
49 | } | ||
50 | |||
51 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | std::cerr.rdbuf(sbuf); |
52 | 1 | } | |
53 | |||
54 |