no-builtin-types-test.cc 647 B

12345678910111213141516171819202122232425
  1. // Formatting library for C++ - formatting library tests
  2. //
  3. // Copyright (c) 2012 - present, Victor Zverovich
  4. // All rights reserved.
  5. //
  6. // For the license information refer to format.h.
  7. #include "gtest/gtest.h"
  8. #if !defined(__GNUC__) || __GNUC__ >= 5
  9. #define FMT_BUILTIN_TYPES 0
  10. #include "fmt/format.h"
  11. TEST(no_builtin_types_test, format) {
  12. EXPECT_EQ(fmt::format("{}", 42), "42");
  13. EXPECT_EQ(fmt::format("{}", 42L), "42");
  14. }
  15. TEST(no_builtin_types_test, double_is_custom_type) {
  16. double d = 42;
  17. auto args = fmt::make_format_args(d);
  18. EXPECT_EQ(fmt::format_args(args).get(0).type(),
  19. fmt::detail::type::custom_type);
  20. }
  21. #endif