Catch2 updated to v3.8, all tests migrated

This commit is contained in:
Jan Bařtipán 2025-02-05 20:12:23 +01:00
parent 8e7e26289d
commit 2b01d14f7b
96 changed files with 236 additions and 127 deletions

View File

@ -1,6 +1,7 @@
add_cmake_project(Catch2
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.10.zip"
URL_HASH SHA256=121e7488912c2ce887bfe4699ebfb983d0f2e0d68bcd60434cdfd6bb0cf78b43
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.8.0.zip"
URL_HASH SHA256=bffd2c45a84e5a4b0c17e695798e8d2f65931cbaf5c7556d40388d1d8d04eb83
CMAKE_ARGS
-DCATCH_BUILD_TESTING:BOOL=OFF
-DCMAKE_CXX_STANDARD=17
)

View File

@ -1,7 +1,7 @@
# TODO Add individual tests as executables in separate directories
# add_subirectory(<testcase>)
find_package(Catch2 2.9 REQUIRED)
find_package(Catch2 3.8 REQUIRED)
include(Catch)
@ -13,7 +13,7 @@ set(CATCH_EXTRA_ARGS "" CACHE STRING "Extra arguments for catch2 test suites.")
add_library(test_common INTERFACE)
target_include_directories(test_common INTERFACE ${CMAKE_CURRENT_LIST_DIR})
target_compile_definitions(test_common INTERFACE TEST_DATA_DIR=R"\(${TEST_DATA_DIR}\)" CATCH_CONFIG_FAST_COMPILE)
target_link_libraries(test_common INTERFACE Catch2::Catch2)
target_link_libraries(test_common INTERFACE Catch2::Catch2WithMain)
if (APPLE)
target_link_libraries(test_common INTERFACE "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)

View File

@ -1,4 +1,7 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/catch_approx.hpp>
#include "test_utils.hpp"
#include <libslic3r/Execution/ExecutionSeq.hpp>
@ -36,6 +39,8 @@
#include <random>
using namespace Catch;
template<class ArrItem = Slic3r::arr2::ArrangeItem>
static std::vector<ArrItem> prusa_parts(double infl = 0.) {
using namespace Slic3r;

View File

@ -1,4 +1,11 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <catch2/generators/catch_generators_range.hpp>
#include <catch2/generators/catch_generators_all.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/catch_approx.hpp>
#include "test_utils.hpp"
#include <arrange-wrapper/Arrange.hpp>
@ -11,6 +18,8 @@
#include "libslic3r/Geometry/ConvexHull.hpp"
#include "libslic3r/Format/3mf.hpp"
using namespace Catch;
static Slic3r::Model get_example_model_with_20mm_cube()
{
using namespace Slic3r;

View File

@ -4,46 +4,53 @@
#define CATCH_CONFIG_EXTERNAL_INTERFACES
#define CATCH_CONFIG_MAIN
// #define CATCH_CONFIG_DEFAULT_REPORTER "verboseconsole"
#include <catch2/catch.hpp>
#include <catch2/reporters/catch_reporter_streaming_base.hpp>
#include <catch2/catch_all.hpp>
namespace Catch {
struct VerboseConsoleReporter : public ConsoleReporter {
struct VerboseConsoleReporter : public StreamingReporterBase {
double duration = 0.;
using ConsoleReporter::ConsoleReporter;
using StreamingReporterBase::StreamingReporterBase;
static std::string getDescription() {
return "Verbose Console Reporter";
}
void testCaseStarting(TestCaseInfo const& _testInfo) override
{
Colour::use(Colour::Cyan);
stream << "Testing ";
Colour::use(Colour::None);
stream << _testInfo.name << std::endl;
ConsoleReporter::testCaseStarting(_testInfo);
//Colour::use(Colour::Cyan);
m_stream << "Testing ";
//Colour::use(Colour::None);
m_stream << _testInfo.name << std::endl;
StreamingReporterBase::testCaseStarting(_testInfo);
}
void sectionStarting(const SectionInfo &_sectionInfo) override
{
if (_sectionInfo.name != currentTestCaseInfo->name)
stream << _sectionInfo.name << std::endl;
m_stream << _sectionInfo.name << std::endl;
ConsoleReporter::sectionStarting(_sectionInfo);
StreamingReporterBase::sectionStarting(_sectionInfo);
}
void sectionEnded(const SectionStats &_sectionStats) override {
duration += _sectionStats.durationInSeconds;
ConsoleReporter::sectionEnded(_sectionStats);
StreamingReporterBase::sectionEnded(_sectionStats);
}
void testCaseEnded(TestCaseStats const& stats) override
{
if (stats.totals.assertions.allOk()) {
Colour::use(Colour::BrightGreen);
stream << "Passed";
Colour::use(Colour::None);
stream << " in " << duration << " [seconds]\n" << std::endl;
//Colour::use(Colour::BrightGreen);
m_stream << "Passed";
//Colour::use(Colour::None);
m_stream << " in " << duration << " [seconds]\n" << std::endl;
}
duration = 0.;
ConsoleReporter::testCaseEnded(stats);
StreamingReporterBase::testCaseEnded(stats);
}
};

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/benchmark/catch_benchmark_all.hpp>
#include "test_data.hpp"
#include "libslic3r/GCode/SeamGeometry.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "test_data.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/BridgeDetector.hpp>
#include <libslic3r/Geometry.hpp>

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <sstream>
#include <fstream>
@ -7,6 +8,7 @@
using namespace Slic3r;
using namespace Test;
using namespace Catch;
constexpr bool debug_files{false};

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "test_data.hpp"
#include "libslic3r/ClipperZUtils.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <numeric>
#include <sstream>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <exception>
#include <numeric>

View File

@ -1,3 +1,4 @@
#include <catch2/catch_test_macros.hpp>
#include "test_data.hpp"
#include "libslic3r/TriangleMesh.hpp"
@ -399,7 +400,6 @@ bool contains_regex(const std::string &data, const std::string &pattern)
} } // namespace Slic3r::Test
#include <catch2/catch.hpp>
SCENARIO("init_print functionality", "[test_data]") {
GIVEN("A default config") {

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <cstdlib>
@ -11,6 +12,7 @@
#include "test_data.hpp"
using namespace Slic3r;
using namespace Catch;
static inline Slic3r::Point random_point(float LO=-50, float HI=50)
{

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <numeric>
#include <sstream>

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <numeric>
#include <sstream>
@ -12,6 +13,7 @@
using namespace Slic3r::Test;
using namespace Slic3r;
using namespace Catch;
SCENARIO("Extrusion width specifics", "[Flow]") {

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Geometry/ConvexHull.hpp"

View File

@ -2,7 +2,8 @@
* Mostly ported from t/gcode.t
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <memory>
#include <regex>
@ -14,6 +15,7 @@
using namespace Slic3r;
using namespace Test;
using namespace Catch;
constexpr bool debug_files = false;
@ -65,7 +67,7 @@ TEST_CASE("Wiping speeds", "[GCode]") {
INFO("Wipe moves don\'t retract faster than configured speed");
CHECK(retract_speed < expected_retract_speed);
}
INFO("No wiping after layer change")
INFO("No wiping after layer change");
CHECK(!wiping_on_new_layer);
}

View File

@ -1,4 +1,6 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_all.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/GCode/Travels.hpp>
#include <libslic3r/ExPolygon.hpp>
#include <libslic3r/GCode.hpp>
@ -6,8 +8,9 @@
using namespace Slic3r;
using namespace Slic3r::GCode::Impl::Travels;
using namespace Catch;
struct ApproxEqualsPoints : public Catch::MatcherBase<Points> {
struct ApproxEqualsPoints : public Catch::Matchers::MatcherBase<Points> {
ApproxEqualsPoints(const Points& expected, unsigned tolerance): expected(expected), tolerance(tolerance) {}
bool match(const Points& points) const override {
if (points.size() != expected.size()) {

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <memory>

View File

@ -1,4 +1,6 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <memory>
@ -12,22 +14,22 @@ SCENARIO("set_speed emits values with fixed-point output.", "[GCodeWriter]") {
GCodeWriter writer;
WHEN("set_speed is called to set speed to 99999.123") {
THEN("Output string is G1 F99999.123") {
REQUIRE_THAT(writer.set_speed(99999.123), Catch::Equals("G1 F99999.123\n"));
REQUIRE_THAT(writer.set_speed(99999.123), Catch::Matchers::Equals("G1 F99999.123\n"));
}
}
WHEN("set_speed is called to set speed to 1") {
THEN("Output string is G1 F1") {
REQUIRE_THAT(writer.set_speed(1.0), Catch::Equals("G1 F1\n"));
REQUIRE_THAT(writer.set_speed(1.0), Catch::Matchers::Equals("G1 F1\n"));
}
}
WHEN("set_speed is called to set speed to 203.200022") {
THEN("Output string is G1 F203.2") {
REQUIRE_THAT(writer.set_speed(203.200022), Catch::Equals("G1 F203.2\n"));
REQUIRE_THAT(writer.set_speed(203.200022), Catch::Matchers::Equals("G1 F203.2\n"));
}
}
WHEN("set_speed is called to set speed to 203.200522") {
THEN("Output string is G1 F203.201") {
REQUIRE_THAT(writer.set_speed(203.200522), Catch::Equals("G1 F203.201\n"));
REQUIRE_THAT(writer.set_speed(203.200522), Catch::Matchers::Equals("G1 F203.201\n"));
}
}
}

View File

@ -2,11 +2,13 @@
* Ported from t/layers.t
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "test_data.hpp"
using namespace Slic3r;
using namespace Slic3r::Test;
using namespace Catch;
void check_layers(const DynamicPrintConfig& config) {
GCodeReader parser;
@ -27,10 +29,10 @@ void check_layers(const DynamicPrintConfig& config) {
const double layer_height = config.opt_float("layer_height");
INFO("Correct first layer height.");
CHECK(z.at(0) == Approx(first_layer_height + z_offset));
INFO("Correct second layer height")
INFO("Correct second layer height");
CHECK(z.at(1) == Approx(first_layer_height + layer_height + z_offset));
INFO("Correct layer height")
INFO("Correct layer height");
for (const double increment : tcb::span{increments}.subspan(1)) {
CHECK(increment == Approx(layer_height));
}

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Model.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <numeric>
#include <sstream>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <numeric>
#include <sstream>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Print.hpp"

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/GCodeReader.hpp"
@ -10,6 +11,7 @@
using namespace Slic3r;
using namespace Slic3r::Test;
using namespace Catch;
boost::regex perimeters_regex("G1 X[-0-9.]* Y[-0-9.]* E[-0-9.]* ; perimeter");
boost::regex infill_regex("G1 X[-0-9.]* Y[-0-9.]* E[-0-9.]* ; infill");

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Print.hpp"
@ -8,6 +9,7 @@
using namespace Slic3r;
using namespace Slic3r::Test;
using namespace Catch;
SCENARIO("PrintObject: object layer heights", "[PrintObject]") {
GIVEN("20mm cube and default initial config, initial layer height of 2mm") {

View File

@ -2,7 +2,8 @@
* Ported from t/retraction.t
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/GCodeReader.hpp>
#include <libslic3r/Config.hpp>
@ -13,6 +14,7 @@
using namespace Slic3r;
using namespace Test;
using namespace Catch;
constexpr bool debug_files {false};
@ -77,7 +79,7 @@ void check_gcode(std::initializer_list<TestMesh> meshes, const DynamicPrintConfi
lift_dist = line.dist_Z(self);
}
if (line.dist_Z(self) < 0) {
INFO("Must be lifted before going down.")
INFO("Must be lifted before going down.");
CHECK(lifted);
INFO("Going down by the same amount of the lift or by the amount needed to get to next layer");
CHECK((

View File

@ -1,11 +1,13 @@
#include <libslic3r/Point.hpp>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/GCode/SeamAligned.hpp>
#include "test_data.hpp"
#include <fstream>
using namespace Slic3r;
using namespace Slic3r::Seams;
using namespace Catch;
constexpr bool debug_files{false};

View File

@ -1,9 +1,12 @@
#include <libslic3r/Point.hpp>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/GCode/SeamGeometry.hpp>
#include <libslic3r/Geometry.hpp>
using namespace Slic3r;
using namespace Catch;
TEST_CASE("Lists mapping", "[Seams][SeamGeometry]") {
// clang-format off

View File

@ -2,7 +2,8 @@
#include "libslic3r/GCode/SeamPerimeters.hpp"
#include "libslic3r/Layer.hpp"
#include "libslic3r/Point.hpp"
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/GCode/SeamGeometry.hpp>
#include <libslic3r/Geometry.hpp>
#include <fstream>
@ -11,6 +12,7 @@
using namespace Slic3r;
using namespace Slic3r::Seams;
using namespace Catch;
constexpr bool debug_files{false};

View File

@ -1,5 +1,5 @@
#include <libslic3r/Point.hpp>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/GCode/SeamRandom.hpp>
#include "test_data.hpp"
#include <fstream>

View File

@ -1,5 +1,5 @@
#include <libslic3r/Point.hpp>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/GCode/SeamRear.hpp>
#include "test_data.hpp"
#include <fstream>

View File

@ -1,9 +1,11 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/GCode/SeamScarf.hpp>
#include <libslic3r/GCode/SmoothPath.hpp>
using namespace Slic3r;
using Seams::Scarf::Impl::PathPoint;
using namespace Catch;
TEST_CASE("Get path point", "[Seams][Scarf]") {
using Seams::Scarf::Impl::get_path_point;

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <filesystem>
#include <fstream>
#include "libslic3r/ClipperUtils.hpp"
@ -9,6 +10,7 @@
using namespace Slic3r;
using namespace Slic3r::Seams;
using namespace Catch;
struct ProjectionFixture
{

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/GCodeReader.hpp"

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Config.hpp"
@ -10,6 +11,7 @@
using namespace Slic3r::Test;
using namespace Slic3r;
using namespace Catch;
/// Helper method to find the tool used for the brim (always the first extrusion)
static int get_brim_tool(const std::string &gcode)

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/GCodeReader.hpp"
#include "libslic3r/Layer.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <numeric>
#include <sstream>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/TriangleMesh.hpp"
#include "libslic3r/TriangleMeshSlicer.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Model.hpp"
#include "libslic3r/Format/3mf.hpp"

View File

@ -1,5 +1,6 @@
#include <algorithm>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <test_utils.hpp>
#include <libslic3r/TriangleMesh.hpp>
@ -7,6 +8,7 @@
#include <libslic3r/AABBTreeLines.hpp>
using namespace Slic3r;
using namespace Catch;
TEST_CASE("Building a tree over a box, ray caster and closest query", "[AABBIndirect]")
{

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/libslic3r.h>
#include <libslic3r/AnyPtr.hpp>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Arachne/WallToolPaths.hpp"
#include "libslic3r/ClipperUtils.hpp"

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <test_utils.hpp>
#include <random>
@ -12,6 +13,7 @@
#include <libslic3r/libslic3r.h>
using namespace Slic3r;
using namespace Catch;
TEST_CASE("arc basics", "[ArcWelder]") {
using namespace Slic3r::Geometry;

View File

@ -1,4 +1,6 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/AStar.hpp"
@ -6,6 +8,7 @@
#include "libslic3r/PointGrid.hpp"
using namespace Slic3r;
using namespace Catch;
TEST_CASE("Testing basic invariants of AStar", "[AStar]") {
struct DummyTracer {

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <iostream>
#include <boost/filesystem.hpp>
@ -8,6 +9,7 @@
#include "libslic3r/SVG.hpp"
using namespace Slic3r;
using namespace Catch;
// #define TESTS_EXPORT_SVGS

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <numeric>
#include <iostream>
@ -9,6 +10,7 @@
#include "libslic3r/SVG.hpp"
using namespace Slic3r;
using namespace Catch;
SCENARIO("Various Clipper operations - xs/t/11_clipper.t", "[ClipperUtils]") {
// CCW oriented contour

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/libslic3r.h"
#include "libslic3r/Color.hpp"

View File

@ -1,4 +1,6 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
#include "libslic3r/Config.hpp"
#include "libslic3r/PrintConfig.hpp"

View File

@ -1,10 +1,13 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <test_utils.hpp>
#include <libslic3r/Geometry/Curves.hpp>
#include <libslic3r/Utils.hpp>
#include <libslic3r/SVG.hpp>
using namespace Catch;
TEST_CASE("Curves: cubic b spline fit test", "[Curves]") {
using namespace Slic3r;
using namespace Slic3r::Geometry;

View File

@ -1,10 +1,10 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/CutSurface.hpp>
#include <libslic3r/TriangleMesh.hpp> // its_make_cube + its_merge
using namespace Slic3r;
TEST_CASE("Cut character from surface", "[]")
TEST_CASE("Cut character from surface", "[Emboss]")
{
std::string font_path = std::string(TEST_DATA_DIR) +
"/../../resources/fonts/NotoSans-Regular.ttf";

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <iostream>
#include <boost/filesystem.hpp>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/Emboss.hpp>
#include <libslic3r/SVG.hpp> // only debug visualization
@ -414,7 +414,7 @@ TEST_CASE("ray segment intersection", "[MeshBoolean]")
CHECK(abs(*t1 - *t2) < std::numeric_limits<double>::epsilon());
}
TEST_CASE("triangle intersection", "[]")
TEST_CASE("triangle intersection", "[its]")
{
Vec2d point(1, 1);
Vec2d dir(-1, 0);
@ -483,7 +483,7 @@ TEST_CASE("Italic check", "[Emboss]")
#endif // FONT_DIR_PATH
#include "libslic3r/CutSurface.hpp"
TEST_CASE("Cut surface", "[]")
TEST_CASE("Cut surface", "[its]")
{
std::string font_path = get_font_filepath();
char letter = '%';

View File

@ -1,10 +1,12 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/ExPolygon.hpp"
using namespace Slic3r;
using namespace Catch;
static inline bool points_close(const Point &p1, const Point &p2)
{

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Point.hpp"
#include "libslic3r/BoundingBox.hpp"

View File

@ -1,6 +1,6 @@
#include <iostream>
#include <fstream>
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/SLA/Hollowing.hpp"

View File

@ -1,6 +1,7 @@
#include <iostream>
#include <fstream>
#include <catch2/catch.hpp>
#include <random>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/TriangleMesh.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/BoundingBox.hpp"
#include "libslic3r/JumpPointSearch.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/KDTreeIndirect.hpp"
#include "libslic3r/Execution/ExecutionSeq.hpp"

View File

@ -2,11 +2,13 @@
#include "libslic3r/Geometry.hpp"
#include "libslic3r/Point.hpp"
#include "libslic3r/SVG.hpp"
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/LayerRegion.hpp>
using namespace Slic3r;
using namespace Slic3r::Algorithm;
using namespace Catch;
constexpr bool export_svgs = false;

View File

@ -2,7 +2,9 @@
* Ported from xs/t/10_line.t
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <libslic3r/Line.hpp>
#include "test_utils.hpp"
@ -37,7 +39,7 @@ TEST_CASE("Parallel lines under angles", "[Line]") {
CHECK(line.parallel_to(line.direction()));
INFO("Line is parallel to its direction + PI");
line.parallel_to(line.direction() + M_PI);
INFO("line is parallel to its direction - PI")
INFO("line is parallel to its direction - PI");
line.parallel_to(line.direction() - M_PI);
SECTION("Line is parallel within epsilon") {

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <test_utils.hpp>
#include <fstream>

View File

@ -1,10 +1,12 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <test_utils.hpp>
#include <libslic3r/TriangleMesh.hpp>
#include <libslic3r/MeshBoolean.hpp>
using namespace Slic3r;
using namespace Catch;
TEST_CASE("CGAL and TriangleMesh conversions", "[MeshBoolean]") {
TriangleMesh sphere = make_sphere(1.);

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/MultipleBeds.hpp>
#include <numeric>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Point.hpp"
#include "libslic3r/MutablePolygon.hpp"

View File

@ -1,6 +1,7 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <queue>
#include <random>
#include "libslic3r/MutablePriorityQueue.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <test_utils.hpp>
#include <libslic3r/Optimize/BruteforceOptimizer.hpp>

View File

@ -1,9 +1,11 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "libslic3r/PlaceholderParser.hpp"
#include "libslic3r/PrintConfig.hpp"
using namespace Slic3r;
using namespace Catch;
SCENARIO("Placeholder parser scripting", "[PlaceholderParser]") {
PlaceholderParser parser;

View File

@ -2,7 +2,7 @@
#define NOMINMAX
#endif
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <numeric>

View File

@ -5,11 +5,13 @@
* and cross product uses doubles
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_all.hpp>
#include <libslic3r/Point.hpp>
#include "test_utils.hpp"
using namespace Slic3r;
using namespace Catch;
TEST_CASE("Nearest point", "[Point]") {
const Point point{10, 15};

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Point.hpp"
#include "libslic3r/Polygon.hpp"

View File

@ -1,7 +1,7 @@
/**
* Ported from xs/t/09_polyline.t
*/
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Point.hpp"
#include "libslic3r/Polyline.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <igl/qslim.h>
#include <test_utils.hpp>
@ -240,7 +240,7 @@ TEST_CASE("Simplify frog_legs.obj to 5% by Quadric edge collapse", "[its][quadri
Private::is_better_similarity(mesh.its, its, Private::frog_leg_5);
}
TEST_CASE("Simplify frog_legs.obj to 5% by IGL/qslim", "[]")
TEST_CASE("Simplify frog_legs.obj to 5% by IGL/qslim", "[its]")
{
std::string obj_filename = "frog_legs.obj";
TriangleMesh mesh = load_model(obj_filename);

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <libslic3r/libslic3r.h>
#include <libslic3r/Algorithm/RegionExpansion.hpp>
@ -8,6 +9,7 @@
#include <libslic3r/SVG.cpp>
using namespace Slic3r;
using namespace Catch;
//#define DEBUG_TEMP_DIR "d:\\temp\\"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <string_view>
#include "libslic3r/StaticMap.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Model.hpp"
#include "libslic3r/Format/STL.hpp"

View File

@ -1,9 +1,12 @@
#include "libslic3r/Point.hpp"
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <libslic3r/SupportSpotsGenerator.hpp>
using namespace Slic3r;
using namespace SupportSpotsGenerator;
using namespace Catch;
namespace Rectangle {
const float width = 10;

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <test_utils.hpp>

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Time.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/Triangulation.hpp>
#include <libslic3r/SVG.hpp> // only debug visualization

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/libslic3r.h"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <libslic3r/Polygon.hpp>
#include <libslic3r/Polyline.hpp>
@ -6,6 +6,7 @@
#include <libslic3r/Geometry/VoronoiOffset.hpp>
#include <numeric>
#include <random>
//#define VORONOI_DEBUG_OUT

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <test_utils.hpp>
#include "libslic3r/SLAPrint.hpp"

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <test_utils.hpp>
#include <libslic3r/AABBMesh.hpp>
@ -7,6 +8,7 @@
#include "sla_test_utils.hpp"
using namespace Slic3r;
using namespace Catch;
// First do a simple test of the hole raycaster.
TEST_CASE("Raycaster - find intersections of a line and cylinder")

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <test_utils.hpp>
#include <libslic3r/ExPolygon.hpp>

View File

@ -1,4 +1,5 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <test_utils.hpp>
#include <unordered_set>
@ -7,6 +8,8 @@
#include "libslic3r/SLA/SupportTreeUtils.hpp"
#include "libslic3r/SLA/SupportTreeUtilsLegacy.hpp"
using Catch::Approx;
// Test pair hash for 'nums' random number pairs.
template <class I, class II> void test_pairhash()
{

View File

@ -1,7 +1,8 @@
#ifndef SLA_TEST_UTILS_HPP
#define SLA_TEST_UTILS_HPP
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <test_utils.hpp>
// Debug
@ -22,6 +23,7 @@
#include "libslic3r/SVG.hpp"
using namespace Slic3r;
using Catch::Approx;
enum e_validity {
ASSUME_NO_EMPTY = 1,

View File

@ -1,4 +1,6 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/generators/catch_generators.hpp>
#include <test_utils.hpp>
#include <algorithm>
@ -8,6 +10,8 @@
#include "libslic3r/MTUtils.hpp"
#include "libslic3r/SVG.hpp"
using Catch::Approx;
void print_depthmap(std::string_view prefix,
const Slic3r::BoundingBox &bb,
const Slic3r::sla::zcorr_detail::DepthMap &dm)

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_test_macros.hpp"
#include "slic3r/Utils/Secrets.hpp"

View File

@ -1,4 +1,6 @@
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include "test_utils.hpp"
#include <random>
@ -14,6 +16,8 @@
#include "libslic3r/Format/3mf.hpp"
using Catch::Approx;
class RandomArrangeSettings: public Slic3r::arr2::ArrangeSettingsView {
Slic3r::arr2::ArrangeSettingsDb::Values m_v;

View File

@ -1,4 +1,5 @@
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_template_test_macros.hpp>>
#include <chrono>
#include <thread>

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include <catch2/catch_test_macros.hpp>
#include "slic3r/Config/Version.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include "libslic3r/Config.hpp"
#include "libslic3r/PrintConfig.hpp"

View File

@ -1,4 +1,4 @@
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <test_utils.hpp>
#include <libslic3r/GCode/Thumbnails.hpp>