// Formatting library for C++ - core tests // // Copyright (c) 2012 - present, Victor Zverovich // All rights reserved. // // For the license information refer to format.h. // clang-format off #include "test-assert.h" // clang-format on #include "fmt/core.h" #include // std::copy_n #include // INT_MAX #include // std::strlen #include // std::equal_to #include // std::back_insert_iterator #include // std::numeric_limits #include // std::string #include // std::is_same #include "gmock.h" #if defined(FMT_COMPILE_TIME_CHECKS) && FMT_COMPILE_TIME_CHECKS # include "fmt/format.h" #endif using fmt::string_view; using fmt::detail::buffer; using testing::_; using testing::Invoke; using testing::Return; TEST(string_view_test, value_type) { static_assert(std::is_same::value, ""); } TEST(string_view_test, length) { // Test that string_view::size() returns string length, not buffer size. char str[100] = "some string"; EXPECT_EQ(std::strlen(str), string_view(str).size()); EXPECT_LT(std::strlen(str), sizeof(str)); } // Check string_view's comparison operator. template