Trying to fix compilation issues of the test cases on OSX.

This commit is contained in:
bubnikv 2019-10-15 19:04:02 +02:00
parent 72e99cf35f
commit 21837ceb85

View file

@ -33,7 +33,7 @@ SCENARIO("Extrusion width specifics", "[!mayfail]") {
std::vector<double> E_per_mm_bottom;
std::string gcode = Test::gcode(print);
Slic3r::GCodeReader parser;
const auto layer_height { config->opt_float("layer_height") };
const double layer_height = config->opt_float("layer_height");
parser.parse_buffer(gcode, [&E_per_mm_bottom, layer_height] (Slic3r::GCodeReader& self, const Slic3r::GCodeReader::GCodeLine& line)
{
if (self.z() == Approx(layer_height).margin(0.01)) { // only consider first layer
@ -44,7 +44,7 @@ SCENARIO("Extrusion width specifics", "[!mayfail]") {
});
THEN(" First layer width applies to everything on first layer.") {
bool pass = false;
auto avg_E {std::accumulate(E_per_mm_bottom.cbegin(), E_per_mm_bottom.cend(), 0.0) / static_cast<double>(E_per_mm_bottom.size())};
double avg_E = std::accumulate(E_per_mm_bottom.cbegin(), E_per_mm_bottom.cend(), 0.0) / static_cast<double>(E_per_mm_bottom.size());
pass = (std::count_if(E_per_mm_bottom.cbegin(), E_per_mm_bottom.cend(), [avg_E] (const double& v) { return v == Approx(avg_E); }) == 0);
REQUIRE(pass == true);
@ -91,7 +91,7 @@ SCENARIO(" Bridge flow specifics.", "[!mayfail]") {
/// spacing, etc
SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
GIVEN("Nozzle Diameter of 0.4, a desired width of 1mm and layer height of 0.5") {
auto width {ConfigOptionFloatOrPercent(1.0, false)};
ConfigOptionFloatOrPercent width(1.0, false);
float spacing {0.4};
float nozzle_diameter {0.4};
float bridge_flow {1.0};
@ -99,16 +99,16 @@ SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
// Spacing for non-bridges is has some overlap
THEN("External perimeter flow has spacing fixed to 1.1*nozzle_diameter") {
auto flow {Flow::new_from_config_width(frExternalPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f)};
auto flow = Flow::new_from_config_width(frExternalPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f);
REQUIRE(flow.spacing() == Approx((1.1*nozzle_diameter) - layer_height * (1.0 - PI / 4.0)));
}
THEN("Internal perimeter flow has spacing of 1.05 (minimum)") {
auto flow {Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f)};
auto flow = Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f);
REQUIRE(flow.spacing() == Approx((1.05*nozzle_diameter) - layer_height * (1.0 - PI / 4.0)));
}
THEN("Spacing for supplied width is 0.8927f") {
auto flow {Flow::new_from_config_width(frExternalPerimeter, width, nozzle_diameter, layer_height, 0.0f)};
auto flow = Flow::new_from_config_width(frExternalPerimeter, width, nozzle_diameter, layer_height, 0.0f);
REQUIRE(flow.spacing() == Approx(width.value - layer_height * (1.0 - PI / 4.0)));
flow = Flow::new_from_config_width(frPerimeter, width, nozzle_diameter, layer_height, 0.0f);
REQUIRE(flow.spacing() == Approx(width.value - layer_height * (1.0 - PI / 4.0)));
@ -123,14 +123,14 @@ SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
WHEN("layer height is set to 0.2") {
layer_height = 0.15f;
THEN("Max width is set.") {
auto flow {Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f)};
auto flow = Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f);
REQUIRE(flow.width == Approx(1.4*nozzle_diameter));
}
}
WHEN("Layer height is set to 0.2") {
layer_height = 0.3f;
THEN("Min width is set.") {
auto flow {Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f)};
auto flow = Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f);
REQUIRE(flow.width == Approx(1.05*nozzle_diameter));
}
}
@ -143,7 +143,7 @@ SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
GIVEN("Input spacing of 0.414159 and a total width of 2") {
double in_spacing = 0.414159;
double total_width = 2.0;
auto flow {Flow::new_from_spacing(1.0, 0.4, 0.3, false)};
auto flow = Flow::new_from_spacing(1.0, 0.4, 0.3, false);
WHEN("solid_spacing() is called") {
double result = flow.solid_spacing(total_width, in_spacing);
THEN("Yielded spacing is greater than 0") {
@ -158,13 +158,13 @@ SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
/// Spacing, width calculation for bridge extrusions
SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
GIVEN("Nozzle Diameter of 0.4, a desired width of 1mm and layer height of 0.5") {
auto width {ConfigOptionFloatOrPercent(1.0, false)};
auto spacing {0.4};
auto nozzle_diameter {0.4};
auto bridge_flow {1.0};
auto layer_height {0.5};
auto width = ConfigOptionFloatOrPercent(1.0, false);
double spacing = 0.4;
double nozzle_diameter = 0.4;
double bridge_flow = 1.0;
double layer_height = 0.5;
WHEN("Flow role is frExternalPerimeter") {
auto flow {Flow::new_from_config_width(frExternalPerimeter, width, nozzle_diameter, layer_height, bridge_flow)};
auto flow = Flow::new_from_config_width(frExternalPerimeter, width, nozzle_diameter, layer_height, bridge_flow);
THEN("Bridge width is same as nozzle diameter") {
REQUIRE(flow.width == Approx(nozzle_diameter));
}
@ -173,7 +173,7 @@ SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
}
}
WHEN("Flow role is frInfill") {
auto flow {Flow::new_from_config_width(frInfill, width, nozzle_diameter, layer_height, bridge_flow)};
auto flow = Flow::new_from_config_width(frInfill, width, nozzle_diameter, layer_height, bridge_flow);
THEN("Bridge width is same as nozzle diameter") {
REQUIRE(flow.width == Approx(nozzle_diameter));
}
@ -182,7 +182,7 @@ SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
}
}
WHEN("Flow role is frPerimeter") {
auto flow {Flow::new_from_config_width(frPerimeter, width, nozzle_diameter, layer_height, bridge_flow)};
auto flow = Flow::new_from_config_width(frPerimeter, width, nozzle_diameter, layer_height, bridge_flow);
THEN("Bridge width is same as nozzle diameter") {
REQUIRE(flow.width == Approx(nozzle_diameter));
}
@ -191,7 +191,7 @@ SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
}
}
WHEN("Flow role is frSupportMaterial") {
auto flow {Flow::new_from_config_width(frSupportMaterial, width, nozzle_diameter, layer_height, bridge_flow)};
auto flow = Flow::new_from_config_width(frSupportMaterial, width, nozzle_diameter, layer_height, bridge_flow);
THEN("Bridge width is same as nozzle diameter") {
REQUIRE(flow.width == Approx(nozzle_diameter));
}