1 //===----------------------------------------------------------------------===//
2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
14 // template<ranges::input_range R, class charT>
15 // struct range-default-formatter<range_format::sequence, R, charT>
17 // template<class ParseContext>
18 // constexpr typename ParseContext::iterator
19 // parse(ParseContext& ctx);
26 #include "test_format_context.h"
27 #include "test_macros.h"
28 #include "make_string.h"
30 #define SV(S) MAKE_STRING_VIEW(CharT, S)
32 template <class StringViewT
>
33 constexpr void test_parse(StringViewT fmt
, std::size_t offset
) {
34 using CharT
= typename
StringViewT::value_type
;
35 auto parse_ctx
= std::basic_format_parse_context
<CharT
>(fmt
);
36 std::formatter
<std::array
<int, 2>, CharT
> formatter
;
37 static_assert(std::semiregular
<decltype(formatter
)>);
39 std::same_as
<typename
StringViewT::iterator
> auto it
= formatter
.parse(parse_ctx
);
40 assert(it
== fmt
.end() - offset
);
43 template <class CharT
>
44 constexpr void test_fmt() {
45 test_parse(SV(""), 0);
46 test_parse(SV(":5"), 0);
48 test_parse(SV("}"), 1);
49 test_parse(SV(":5}"), 1);
52 constexpr bool test() {
54 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
61 int main(int, char**) {
63 static_assert(test());