mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-23 06:01:14 -05:00
* Keep Heavy Boost and Plugin Headers Out of Widely Included Headers Several headers that most of the code includes pulled in large libraries they barely use, so hundreds of files compiled them for nothing: - Point.hpp, Line.hpp, Polygon.hpp and ExPolygon.hpp included all of Boost.Polygon to declare traits. Point and Line now include only the concept headers they need, and the polygon traits move to BoostPolygonTraits.hpp, included by BridgeDetector.cpp, the one file that runs Boost.Polygon algorithms on polygons. - ProjectTask.hpp included Boost.Thread and the filesystem streams but only uses boost::filesystem::path. - Utils.hpp included Boost.DateTime for one inline function, which moves to utils.cpp. - Semver.hpp used boost::format for two version strings; std::to_string prints the same. - MainFrame.hpp held PluginPages by value, which brought in the web view and plugin headers; it now holds it by unique_ptr. - Model.hpp included STEP.hpp, and with it OpenCASCADE, for a forward-declarable type and two typedefs. Files that relied on these headers arriving indirectly now include what they use. * Include What the Polygon Traits and the End-Time Helper Use * Drop Two Unneeded Includes and Include the Filesystem Directory Header
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
#include <catch2/catch_message.hpp>
|
|
#include <catch2/catch_test_macros.hpp>
|
|
#include <catch2/generators/catch_generators.hpp>
|
|
|
|
#include "libslic3r/Semver.hpp"
|
|
|
|
#include <string>
|
|
#include <tuple>
|
|
|
|
using namespace Slic3r;
|
|
|
|
TEST_CASE("A dev build ranks above its alpha and beta and below its release", "[Semver]") {
|
|
const auto [lower, higher] = GENERATE(table<std::string, std::string>({
|
|
{ "2.5.0-alpha", "2.5.0-dev" },
|
|
{ "2.5.0-beta", "2.5.0-dev" },
|
|
{ "2.5.0-rc", "2.5.0-dev" },
|
|
{ "2.5.0-alpha", "2.5.0-beta" },
|
|
{ "2.5.0-dev", "2.5.0" },
|
|
{ "2.4.2", "2.5.0-dev" },
|
|
{ "2.5.0", "2.6.0-dev" },
|
|
}));
|
|
INFO(lower << " < " << higher);
|
|
const Semver lo(lower);
|
|
const Semver hi(higher);
|
|
CHECK(lo < hi);
|
|
CHECK(hi > lo);
|
|
CHECK_FALSE(hi < lo);
|
|
}
|
|
|
|
TEST_CASE("Two dev builds of the same version are equal", "[Semver]") {
|
|
CHECK(Semver("2.5.0-dev") == Semver("2.5.0-dev"));
|
|
}
|
|
|
|
TEST_CASE("Versions print with the patch split in two, or as three parts", "[Semver]") {
|
|
// to_string() prints the patch as patch / 100 and patch % 100; to_string_sf() prints it whole.
|
|
const Semver release(2, 5, 103);
|
|
CHECK(release.to_string() == "2.5.1.3");
|
|
CHECK(release.to_string_sf() == "2.5.103");
|
|
|
|
const Semver dev(2, 6, 0, nullptr, "dev");
|
|
CHECK(dev.to_string() == "2.6.0.0-dev");
|
|
CHECK(dev.to_string_sf() == "2.6.0-dev");
|
|
|
|
const Semver large(10, 20, 1234);
|
|
CHECK(large.to_string() == "10.20.12.34");
|
|
CHECK(large.to_string_sf() == "10.20.1234");
|
|
|
|
const Semver tagged(1, 2, 3, "build7");
|
|
CHECK(tagged.to_string() == "1.2.0.3+build7");
|
|
CHECK(tagged.to_string_sf() == "1.2.3+build7");
|
|
}
|