From ac3f4f2d03cbe255bb54b5488b31e537757c6b5c Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 30 Mar 2019 19:01:11 -0500 Subject: [PATCH] Add test_gcode.cpp --- src/test/libslic3r/test_gcode.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/libslic3r/test_gcode.cpp diff --git a/src/test/libslic3r/test_gcode.cpp b/src/test/libslic3r/test_gcode.cpp new file mode 100644 index 000000000..f045f72a2 --- /dev/null +++ b/src/test/libslic3r/test_gcode.cpp @@ -0,0 +1,15 @@ +#include + + +#include "GCode/CoolingBuffer.hpp" +#include "GCode.hpp" + +SCENARIO("Cooling buffer speed factor rewrite enforces precision") { + GIVEN("GCode line of set speed") { + std::string gcode_string = "G1 F1000000.000"; + WHEN("40% speed factor is applied to a speed of 1000000 with 3-digit precision") { + Slic3r::apply_speed_factor(gcode_string, (1.0f/3.0f), 30.0); + REQUIRE_THAT(gcode_string, Catch::Equals("G1 F333333.344")); + } + } +}