Skip to content

Commit dcd6744

Browse files
committed
Convert all of AX integration test suite to use gtest
Signed-off-by: Tim Straubinger <[email protected]>
1 parent 5df8871 commit dcd6744

19 files changed

+279
-857
lines changed

openvdb_ax/openvdb_ax/test/frontend/TestArrayPack.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ static const unittest_util::CodeTests tests =
118118

119119
class TestArrayPack : public ::testing::Test
120120
{
121-
void testSyntax() { TEST_SYNTAX_PASSES(tests); }
122-
void testASTNode();
123121
};
124122

125123
TEST_F(TestArrayPack, testSyntax)

openvdb_ax/openvdb_ax/test/integration/TestArrayUnpack.cc

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,15 @@
99
#include <openvdb_ax/compiler/CustomData.h>
1010
#include <openvdb_ax/Exceptions.h>
1111

12-
#include <cppunit/extensions/HelperMacros.h>
13-
1412
using namespace openvdb::points;
1513

1614
class TestArrayUnpack : public unittest_util::AXTestCase
1715
{
1816
public:
19-
2017
std::string dir() const override { return GET_TEST_DIRECTORY(); }
21-
22-
CPPUNIT_TEST_SUITE(TestArrayUnpack);
23-
CPPUNIT_TEST(componentVectorAssignment);
24-
CPPUNIT_TEST(componentMatrixAssignment);
25-
CPPUNIT_TEST_SUITE_END();
26-
27-
void componentVectorAssignment();
28-
void componentMatrixAssignment();
2918
};
3019

31-
CPPUNIT_TEST_SUITE_REGISTRATION(TestArrayUnpack);
32-
33-
void
34-
TestArrayUnpack::componentVectorAssignment()
20+
TEST_F(TestArrayUnpack, componentVectorAssignment)
3521
{
3622
const std::string code = R"(
3723
vec2@test1[0] = vec2@test2[1];
@@ -51,7 +37,7 @@ vec4@test6[1] = vec4@test6[0];
5137
for (const auto& s : suffixes) {
5238
std::string repl = code;
5339
const std::string type = (s == 'i' ? "int" : (s == 'f' ? "float" : (s == 'd' ? "double" : "")));
54-
CPPUNIT_ASSERT(!type.empty());
40+
ASSERT_TRUE(!type.empty());
5541

5642
unittest_util::replace(repl, "vec2", std::string("vec2").append(1, s));
5743
unittest_util::replace(repl, "vec3", std::string("vec3").append(1, s));
@@ -113,8 +99,7 @@ vec4@test6[1] = vec4@test6[0];
11399
}
114100
}
115101

116-
void
117-
TestArrayUnpack::componentMatrixAssignment()
102+
TEST_F(TestArrayUnpack, componentMatrixAssignment)
118103
{
119104
const std::string code = R"(
120105
mat3@test1[0] = mat3@test2[4];
@@ -178,7 +163,7 @@ mat4@test8[3,3] = mat4@test7[2,1];
178163
unittest_util::replace(repl, "mat3", std::string("mat3").append(1,s));
179164
unittest_util::replace(repl, "mat4", std::string("mat4").append(1,s));
180165
const std::string type = s == 'f' ? "float" : s == 'd' ? "double" : "";
181-
CPPUNIT_ASSERT(!type.empty());
166+
ASSERT_TRUE(!type.empty());
182167
this->registerTest(repl, "array_unpack.mat." + type + ".ax");
183168
}
184169
};

openvdb_ax/openvdb_ax/test/integration/TestAssign.cc

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <openvdb_ax/compiler/CustomData.h>
1010
#include <openvdb_ax/Exceptions.h>
1111

12-
#include <cppunit/extensions/HelperMacros.h>
13-
1412
using namespace openvdb::points;
1513

1614
// Configuration values for assignment code
@@ -73,36 +71,9 @@ class TestAssign : public unittest_util::AXTestCase
7371
public:
7472

7573
std::string dir() const override { return GET_TEST_DIRECTORY(); }
76-
77-
CPPUNIT_TEST_SUITE(TestAssign);
78-
CPPUNIT_TEST(directAssignment);
79-
CPPUNIT_TEST(compoundIntegralAssignment);
80-
CPPUNIT_TEST(compoundFloatingAssignment);
81-
CPPUNIT_TEST(compoundVectorAssignment);
82-
CPPUNIT_TEST(compoundMatrixAssignment);
83-
CPPUNIT_TEST(compoundStringAssignment);
84-
CPPUNIT_TEST(implicitScalarAssignment);
85-
CPPUNIT_TEST(implicitContainerAssignment);
86-
CPPUNIT_TEST(implicitContainerScalarAssignment);
87-
CPPUNIT_TEST(scopedAssign);
88-
CPPUNIT_TEST_SUITE_END();
89-
90-
void directAssignment();
91-
void compoundIntegralAssignment();
92-
void compoundFloatingAssignment();
93-
void compoundVectorAssignment();
94-
void compoundMatrixAssignment();
95-
void compoundStringAssignment();
96-
void implicitScalarAssignment();
97-
void implicitContainerAssignment();
98-
void implicitContainerScalarAssignment();
99-
void scopedAssign();
10074
};
10175

102-
CPPUNIT_TEST_SUITE_REGISTRATION(TestAssign);
103-
104-
void
105-
TestAssign::directAssignment()
76+
TEST_F(TestAssign, directAssignment)
10677
{
10778
const std::string code = R"(
10879
_T1_@test1 = _l1_;
@@ -354,8 +325,7 @@ _T1_@test8 = _l1_;
354325
}
355326
}
356327

357-
void
358-
TestAssign::compoundIntegralAssignment()
328+
TEST_F(TestAssign, compoundIntegralAssignment)
359329
{
360330
const std::string code = R"(
361331
_T1_@test1 += _l1_;
@@ -436,8 +406,7 @@ _T1_@test14 += local2;
436406
}
437407
}
438408

439-
void
440-
TestAssign::compoundFloatingAssignment()
409+
TEST_F(TestAssign, compoundFloatingAssignment)
441410
{
442411
const std::string code = R"(
443412
_T1_@test1 += _l1_;
@@ -508,8 +477,7 @@ _T1_@test9 += local2;
508477
}
509478

510479

511-
void
512-
TestAssign::compoundVectorAssignment()
480+
TEST_F(TestAssign, compoundVectorAssignment)
513481
{
514482
const std::string code = R"(
515483
_T1_@test1 += _l1_;
@@ -870,8 +838,7 @@ _T1_@test9 += local2;
870838
}
871839

872840

873-
void
874-
TestAssign::compoundMatrixAssignment()
841+
TEST_F(TestAssign, compoundMatrixAssignment)
875842
{
876843
const std::string code = R"(
877844
_T1_@test1 += _l1_;
@@ -1051,8 +1018,7 @@ _T1_@test7 += local2;
10511018
}
10521019

10531020

1054-
void
1055-
TestAssign::compoundStringAssignment()
1021+
TEST_F(TestAssign, compoundStringAssignment)
10561022
{
10571023
const std::string code = R"(
10581024
_T1_@test1 += _l1_;
@@ -1111,8 +1077,7 @@ _T1_@test5 += local2;
11111077
}
11121078

11131079

1114-
void
1115-
TestAssign::implicitScalarAssignment()
1080+
TEST_F(TestAssign, implicitScalarAssignment)
11161081
{
11171082
auto generate = [this](const auto& source, const auto& targets) {
11181083
for (const auto& t1 : source) {
@@ -1185,8 +1150,7 @@ TestAssign::implicitScalarAssignment()
11851150
}
11861151

11871152

1188-
void
1189-
TestAssign::implicitContainerAssignment()
1153+
TEST_F(TestAssign, implicitContainerAssignment)
11901154
{
11911155
auto generate = [this](const auto& source, const auto& target) {
11921156
for (const auto& t1 : source) {
@@ -1304,8 +1268,7 @@ TestAssign::implicitContainerAssignment()
13041268
}
13051269

13061270

1307-
void
1308-
TestAssign::implicitContainerScalarAssignment()
1271+
TEST_F(TestAssign, implicitContainerScalarAssignment)
13091272
{
13101273
auto generate = [this](const auto& source, const auto& targets) {
13111274
for (const auto& t1 : source) {
@@ -1440,8 +1403,7 @@ TestAssign::implicitContainerScalarAssignment()
14401403
}
14411404

14421405

1443-
void
1444-
TestAssign::scopedAssign()
1406+
TEST_F(TestAssign, scopedAssign)
14451407
{
14461408
const std::string code = R"(
14471409
float var = 30.0f;
@@ -1488,6 +1450,6 @@ float@test1 = var;
14881450
mHarness.addAttributes<float>(names, {30.0f, 1.0f, -10.0f, -15.0f, 50.0f, 50.0f, 1.0f});
14891451
this->execute("assign_scoped.float.ax");
14901452

1491-
CPPUNIT_ASSERT(mHarness.mLogger.hasWarning());
1453+
ASSERT_TRUE(mHarness.mLogger.hasWarning());
14921454
}
14931455

0 commit comments

Comments
 (0)