diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f30ca70a..92887df5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,20 +3,21 @@ add_library(test-main ${TEST_MAIN_SRC}) target_link_libraries(test-main gtest) # Adds a test. -# Usage: add_fmt_test(name libs srcs...) -function(add_fmt_test name libs) +# Usage: add_fmt_test(name [CUSTOM_LINK] srcs...) +function(add_fmt_test name) cmake_parse_arguments(add_fmt_test CUSTOM_LINK "" "" ${ARGN}) add_executable(${name} ${name}.cc ${add_fmt_test_UNPARSED_ARGUMENTS}) - target_link_libraries(${name} ${libs}) + target_link_libraries(${name} test-main) if (NOT add_fmt_test_CUSTOM_LINK) target_link_libraries(${name} format) endif () add_test(${name} ${name}) endfunction() -add_fmt_test(gtest-extra-test test-main) -add_fmt_test(format-test test-main CUSTOM_LINK ../posix.cc ../posix.h) -add_fmt_test(printf-test test-main) +add_fmt_test(gtest-extra-test) +add_fmt_test(format-test) +add_fmt_test(format-impl-test CUSTOM_LINK) +add_fmt_test(printf-test) foreach (target format-test printf-test) if (CMAKE_COMPILER_IS_GNUCXX) set_target_properties(${target} PROPERTIES COMPILE_FLAGS @@ -26,7 +27,7 @@ foreach (target format-test printf-test) set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${CPP11_FLAG}) endif () endforeach () -add_fmt_test(util-test test-main) +add_fmt_test(util-test) foreach (src ${FMT_SOURCES}) set(FMT_TEST_SOURCES ${FMT_TEST_SOURCES} ../${src}) diff --git a/test/format-test.cc b/test/format-test.cc index 5be74ab3..8171b7cc 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -36,7 +36,7 @@ #include // Include format.cc instead of format.h to test implementation-specific stuff. -#include "format.cc" +#include "format.h" #include "util.h" #include "gtest-extra.h" @@ -1226,10 +1226,6 @@ TEST(FormatterTest, FormatNaN) { double nan = std::numeric_limits::quiet_NaN(); EXPECT_EQ("nan", format("{}", nan)); EXPECT_EQ("+nan", format("{:+}", nan)); - if (getsign(-nan)) - EXPECT_EQ("-nan", format("{}", -nan)); - else - fmt::print("Warning: compiler doesn't handle negative NaN correctly"); EXPECT_EQ(" nan", format("{: }", nan)); EXPECT_EQ("NAN", format("{:F}", nan)); EXPECT_EQ("nan ", format("{:<7}", nan)); @@ -1532,15 +1528,6 @@ TEST(FormatTest, FormatMessageExample) { format_message(42, "{} happened", "something")); } -TEST(FormatTest, ArgConverter) { - using fmt::internal::Arg; - Arg arg = Arg(); - arg.type = Arg::LONG_LONG; - arg.long_long_value = std::numeric_limits::max(); - ArgConverter(arg, 'd').visit(arg); - EXPECT_EQ(Arg::LONG_LONG, arg.type); -} - #if FMT_USE_VARIADIC_TEMPLATES template void print_error(const char *file, int line, const char *format,