Skip to content
Snippets Groups Projects

Remove designator aggregate intialization so code compiles with C++17

Merged Deepak Rangarajan requested to merge rangarad/csg-eb:make_tests_compile_with_cpp17 into main
@@ -8,9 +8,14 @@ namespace {
TEST_CASE("linear", "[Levelset Extrude]") {
double height = 100, radius = 10;
auto my_lin_ext = csg::LinearExtrude{
.height = 100, .center = false, .scale = {1, 1}, .group = csg::Union2D()};
csg::Circle my_cir{.name = std::nullopt, .radius = radius};
csg::LinearExtrude my_lin_ext;
my_lin_ext.height = 100;
my_lin_ext.center = false;
my_lin_ext.scale = {1, 1};
my_lin_ext.group = csg::Union2D();
csg::Circle my_cir;
my_cir.radius = radius;
SECTION("Not centered") {
my_lin_ext.center = false;
@@ -100,10 +105,15 @@ TEST_CASE("linear", "[Levelset Extrude]") {
}
TEST_CASE("two shape linear extrude", "[Levelset Extrude]") {
auto my_lin_ext = csg::LinearExtrude{
.height = 100, .center = true, .scale = {1, 1}, .group = csg::Union2D()};
csg::LinearExtrude my_lin_ext;
my_lin_ext.height = 100;
my_lin_ext.center = true;
my_lin_ext.scale = {1, 1};
my_lin_ext.group = csg::Union2D();
csg::Circle my_cir;
my_cir.radius = 1;
csg::Circle my_cir{.name = std::nullopt, .radius = 1};
my_lin_ext.group.objs.push_back(my_cir);
auto my_mat = csg::Mulmatrix2D({{1, 0}}, {{0, 1}});
@@ -133,9 +143,13 @@ TEST_CASE("two shape linear extrude", "[Levelset Extrude]") {
}
TEST_CASE("simple torus", "[Levelset Extrude]") {
auto my_rot_ext = csg::RotateExtrude{.angle = 360, .group = csg::Union2D()};
csg::RotateExtrude my_rot_ext;
my_rot_ext.angle = 360;
my_rot_ext.group = csg::Union2D();
csg::Circle my_cir;
my_cir.radius = 1;
csg::Circle my_cir{.name = std::nullopt, .radius = 1};
auto my_mat = csg::Mulmatrix2D({{1, 0}}, {{0, 1}});
my_mat.translation = {2, 0};
my_mat.group.objs.push_back(my_cir);
@@ -166,8 +180,11 @@ TEST_CASE("Linear extrude of a triangle with hole", "[Levelset Primitives]") {
double ht = 100.0, outer = 100.0, inner = 80.0;
double thick = outer - inner;
auto my_lin_ext = csg::LinearExtrude{
.height = ht, .center = true, .scale = {1, 1}, .group = csg::Union2D()};
csg::LinearExtrude my_lin_ext;
my_lin_ext.height = ht;
my_lin_ext.center = true;
my_lin_ext.scale = {1, 1};
my_lin_ext.group = csg::Union2D();
// A 100 x 100 right triangle with a 80 x 80 hole formed by using a polygon
// and extrude
@@ -190,9 +207,9 @@ TEST_CASE("Linear extrude of a triangle with hole", "[Levelset Primitives]") {
csg::Union2D my_union;
my_union.objs.push_back(my_inner_tri);
auto my_diff = csg::Difference2D{
.first_obj = std::make_shared<csg::Type2D>(my_outer_tri),
.next_objs = csg::Union2D(my_union)};
csg::Difference2D my_diff;
my_diff.first_obj = std::make_shared<csg::Type2D>(my_outer_tri);
my_diff.next_objs = csg::Union2D(my_union);
my_lin_ext.group.objs.push_back(my_diff);
@@ -248,9 +265,13 @@ TEST_CASE("Linear extrude of a triangle with hole", "[Levelset Primitives]") {
#endif
TEST_CASE("sliced torus", "[Levelset Extrude]") {
auto my_rot_ext = csg::RotateExtrude{.angle = 45, .group = csg::Union2D()};
csg::RotateExtrude my_rot_ext;
my_rot_ext.angle = 45;
my_rot_ext.group = csg::Union2D();
csg::Circle my_cir;
my_cir.radius = 1;
csg::Circle my_cir{.name = std::nullopt, .radius = 1};
auto my_mat = csg::Mulmatrix2D({{1, 0}}, {{0, 1}});
my_mat.translation = {2, 0};
my_mat.group.objs.push_back(my_cir);
@@ -283,12 +304,16 @@ TEST_CASE("sliced torus", "[Levelset Extrude]") {
TEST_CASE("linear with twist", "[Levelset Extrude]") {
double height = 10, radius = 1;
auto my_lin_ext = csg::LinearExtrude{.height = height,
.center = false,
.scale = {1, 1},
.twist = 320,
.group = csg::Union2D()};
csg::Circle my_cir{.name = std::nullopt, .radius = radius};
csg::LinearExtrude my_lin_ext;
my_lin_ext.height = height;
my_lin_ext.center = false;
my_lin_ext.scale = {1, 1};
my_lin_ext.twist = 320;
my_lin_ext.group = csg::Union2D();
csg::Circle my_cir;
my_cir.radius = radius;
auto my_mat = csg::Mulmatrix2D({{1, 0}}, {{0, 1}});
my_mat.translation = {2, 0};
my_mat.group.objs.push_back(my_cir);
Loading