mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Catch2 test framework integration.
This commit is contained in:
parent
ffa544ade3
commit
fe7f2e4d95
14 changed files with 18205 additions and 20 deletions
|
@ -1,4 +1,6 @@
|
|||
#include <gtest/gtest.h>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include "libslic3r/Time.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
@ -13,29 +15,24 @@ void test_time_fmt(Slic3r::Utils::TimeFormat fmt) {
|
|||
|
||||
std::string tstr = time2str(t, TimeZone::local, fmt);
|
||||
time_t parsedtime = str2time(tstr, TimeZone::local, fmt);
|
||||
ASSERT_EQ(t, parsedtime);
|
||||
REQUIRE(t == parsedtime);
|
||||
|
||||
tstr = time2str(t, TimeZone::utc, fmt);
|
||||
parsedtime = str2time(tstr, TimeZone::utc, fmt);
|
||||
ASSERT_EQ(t, parsedtime);
|
||||
REQUIRE(t == parsedtime);
|
||||
|
||||
parsedtime = str2time("not valid string", TimeZone::local, fmt);
|
||||
ASSERT_EQ(parsedtime, time_t(-1));
|
||||
REQUIRE(parsedtime == time_t(-1));
|
||||
|
||||
parsedtime = str2time("not valid string", TimeZone::utc, fmt);
|
||||
ASSERT_EQ(parsedtime, time_t(-1));
|
||||
REQUIRE(parsedtime == time_t(-1));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Timeutils, ISO8601Z) {
|
||||
TEST_CASE("ISO8601Z", "[Timeutils]") {
|
||||
test_time_fmt(Slic3r::Utils::TimeFormat::iso8601Z);
|
||||
}
|
||||
|
||||
TEST(Timeutils, Slic3r_UTC_Time_Format) {
|
||||
TEST_CASE("Slic3r_UTC_Time_Format", "[Timeutils]") {
|
||||
test_time_fmt(Slic3r::Utils::TimeFormat::gcode);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue