Fix integer overflows in libnest2d tests

This commit is contained in:
tamasmeszaros 2021-04-14 08:51:54 +02:00
parent 8845b0245a
commit 41a0e270ac

View File

@ -1171,7 +1171,7 @@ TEST_CASE("Test for biggest bounding box area", "[Nesting], [NestKernels]")
pconfig.object_function = [&pile_box](const Item &item) -> double { pconfig.object_function = [&pile_box](const Item &item) -> double {
Box b = sl::boundingBox(item.boundingBox(), pile_box); Box b = sl::boundingBox(item.boundingBox(), pile_box);
double area = b.area<double>() / (W * W); double area = b.area<double>() / (double(W) * W);
return -area; return -area;
}; };
@ -1187,5 +1187,5 @@ TEST_CASE("Test for biggest bounding box area", "[Nesting], [NestKernels]")
// Here the result shall be a stairway of boxes // Here the result shall be a stairway of boxes
REQUIRE(pile.size() == N); REQUIRE(pile.size() == N);
REQUIRE(bb.area() == N * N * W * W); REQUIRE(bb.area() == double(N) * N * W * W);
} }