mirror of
https://github.com/fmtlib/fmt.git
synced 2026-07-30 08:16:31 +08:00
Simplify test
This commit is contained in:
parent
719823cc64
commit
a2206152d5
@ -874,22 +874,16 @@ struct custom_container {
|
||||
auto operator[](size_t) -> char& { return data; }
|
||||
};
|
||||
|
||||
struct phantom_subscript_operator_container {
|
||||
std::vector<char> buffer;
|
||||
|
||||
struct phantom_subscript_container {
|
||||
using value_type = char;
|
||||
|
||||
auto size() const noexcept -> size_t { return buffer.size(); }
|
||||
auto data() -> char*;
|
||||
auto size() const -> size_t;
|
||||
operator const char*() const;
|
||||
};
|
||||
|
||||
auto data() noexcept -> char* { return buffer.data(); }
|
||||
|
||||
auto data() const noexcept -> const char* { return buffer.data(); }
|
||||
|
||||
void resize(size_t n) { buffer.resize(n); }
|
||||
|
||||
void push_back(const char& value) { buffer.push_back(value); }
|
||||
|
||||
operator const char*() const noexcept { return data(); }
|
||||
struct real_subscript_container : phantom_subscript_container {
|
||||
auto operator[](size_t) -> char&;
|
||||
};
|
||||
|
||||
FMT_BEGIN_NAMESPACE
|
||||
@ -902,7 +896,8 @@ TEST(base_test, is_contiguous) {
|
||||
EXPECT_TRUE((fmt::is_contiguous<fmt::string_view>::value));
|
||||
EXPECT_TRUE((fmt::is_contiguous<std::vector<char>>::value));
|
||||
EXPECT_FALSE((fmt::is_contiguous<std::list<char>>::value));
|
||||
EXPECT_FALSE((fmt::is_contiguous<phantom_subscript_operator_container>::value));
|
||||
EXPECT_FALSE((fmt::is_contiguous<phantom_subscript_container>::value));
|
||||
EXPECT_TRUE((fmt::is_contiguous<real_subscript_container>::value));
|
||||
}
|
||||
|
||||
TEST(base_test, format_to_custom_container) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user