diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2019-12-06 17:47:58 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2019-12-06 17:47:58 +0300 |
commit | 5be66a52c0b2a16794ba722974bd68f21fd405b9 (patch) | |
tree | d967e07d62a91c7faca6f8f5dc1b6ccc8a2a2d88 /tests/libslic3r | |
parent | 3b0241c98b342722b87d0c794a0bf6684ff91b4c (diff) |
add drain hole 3mf export and import
Diffstat (limited to 'tests/libslic3r')
-rw-r--r-- | tests/libslic3r/libslic3r_tests.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/libslic3r/libslic3r_tests.cpp b/tests/libslic3r/libslic3r_tests.cpp index caf5b3b9a..b9c615d90 100644 --- a/tests/libslic3r/libslic3r_tests.cpp +++ b/tests/libslic3r/libslic3r_tests.cpp @@ -11,4 +11,31 @@ TEST_CASE("sort_remove_duplicates", "[utils]") { REQUIRE(data_src == data_dst); } +TEST_CASE("string_printf", "[utils]") { + SECTION("Empty format with empty data should return empty string") { + std::string outs = Slic3r::string_printf(""); + REQUIRE(outs.empty()); + } + + SECTION("String output length should be the same as input") { + std::string outs = Slic3r::string_printf("1234"); + REQUIRE(outs.size() == 4); + } + + SECTION("String format should be interpreted as with sprintf") { + std::string outs = Slic3r::string_printf("%d %f %s", 10, 11.4, " This is a string"); + char buffer[1024]; + + sprintf(buffer, "%d %f %s", 10, 11.4, " This is a string"); + + REQUIRE(outs.compare(buffer) == 0); + } + + SECTION("String format should survive large input data") { + std::string input(2048, 'A'); + std::string outs = Slic3r::string_printf("%s", input.c_str()); + REQUIRE(outs.compare(input) == 0); + } +} + } |