Skip to content

Commit

Permalink
Test: Fix an issue with SDK option test (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal authored Oct 4, 2024
1 parent bcedd6d commit 544ae70
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions library/testing/TestSDKOptions.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,21 @@ int TestSDKOptions(int argc, char* argv[])
});

// Test copy operator and constructor
opt.render.background.color = { 0.1, 0.2, 0.7 };
opt.render.line_width = 2.17;
f3d::options opt2 = opt;
test("copy constructor", opt2.render.line_width == 2.13);
test("copy constructor", opt2.render.line_width == 2.17);

f3d::options opt3;
opt3 = opt2;
test("copy operator", opt3.render.line_width == 2.13);
test("copy operator", opt3.render.line_width == 2.17);

f3d::options opt4 = std::move(opt3);
test("move constructor", opt4.render.line_width == 2.13);
test("move constructor", opt4.render.line_width == 2.17);

f3d::options opt5;
opt5 = std::move(opt4);
test("move operator", opt5.render.line_width == 2.13);
test("move operator", opt5.render.line_width == 2.17);

// Test getNames
std::vector<std::string> names = f3d::options::getAllNames();
Expand All @@ -154,7 +156,7 @@ int TestSDKOptions(int argc, char* argv[])
test("not isSame", !opt.isSame(opt2, "render.line_width"));

opt2.copy(opt, "render.line_width");
test("copy", opt2.render.line_width == 2.13);
test("copy", opt2.render.line_width == 2.17);

// Test isSame/copy vector
test("isSame with vectors", opt.isSame(opt2, "render.background.color"));
Expand All @@ -163,7 +165,7 @@ int TestSDKOptions(int argc, char* argv[])
test("not isSame with vectors", !opt.isSame(opt2, "render.background.color"));

opt2.copy(opt, "render.background.color");
test("copy with vectors", opt2.render.background.color == std::vector<double>({ 0.1, 0.2, 0.5 }));
test("copy with vectors", opt2.render.background.color == std::vector<double>({ 0.1, 0.2, 0.7 }));

// Test isSame/copy error path
test.expect<f3d::options::inexistent_exception>(
Expand Down Expand Up @@ -242,5 +244,5 @@ int TestSDKOptions(int argc, char* argv[])
test.expect<f3d::options::inexistent_exception>(
"removeValue non-existent option", [&]() { opt8.removeValue("dummy"); });

return EXIT_SUCCESS;
return test.result();
}

0 comments on commit 544ae70

Please sign in to comment.