diff --git a/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format.locale.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format.locale.pass.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // string format(const locale& loc, format-string fmt, const Args&... args); // template @@ -24,7 +28,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" diff --git a/libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format.locale.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format.locale.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format.locale.verify.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // string format(const locale& loc, format-string fmt, const Args&... args); // template diff --git a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/format.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format.pass.cpp @@ -16,6 +16,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // string format(format-string fmt, const Args&... args); // template @@ -26,7 +30,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" diff --git a/libcxx/test/std/utilities/format/format.functions/format.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/format.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format.verify.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // string format(format-string fmt, const Args&... args); // template diff --git a/libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.locale.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.locale.pass.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // Out format_to(Out out, const locale& loc, // format-string fmt, const Args&... args); @@ -27,7 +31,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" #include "test_iterators.h" diff --git a/libcxx/test/std/utilities/format/format.functions/format_to.locale.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.locale.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to.locale.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to.locale.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to.locale.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.locale.verify.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // Out format_to(Out out, const locale& loc, // format-string fmt, const Args&... args); diff --git a/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.pass.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // Out format_to(Out out, format-string fmt, const Args&... args); // template @@ -24,7 +28,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" #include "test_iterators.h" diff --git a/libcxx/test/std/utilities/format/format.functions/format_to.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to.verify.cpp @@ -10,6 +10,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // Basic test to validate ill-formed code is properly detected. // template diff --git a/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.locale.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to_n.locale.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.locale.pass.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // format_to_n_result format_to_n(Out out, iter_difference_t n, // const locale& loc, format-string fmt, @@ -29,7 +33,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" diff --git a/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.locale.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to_n.locale.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.locale.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to_n.locale.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.locale.verify.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // format_to_n_result format_to_n(Out out, iter_difference_t n, // const locale& loc, format-string fmt, diff --git a/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to_n.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.pass.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // format_to_n_result format_to_n(Out out, iter_difference_t n, // format-string fmt, const Args&... args); @@ -26,7 +30,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" diff --git a/libcxx/test/std/utilities/format/format.functions/format_to_n.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/format_to_n.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format_to_n.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.format_to_n.verify.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // format_to_n_result format_to_n(Out out, iter_difference_t n, // format-string fmt, const Args&... args); diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.locale.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/formatted_size.locale.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.locale.pass.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // size_t formatted_size(const locale& loc, // format-string fmt, const Args&... args); @@ -25,7 +29,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.locale.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.locale.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.locale.verify.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // size_t formatted_size(const locale& loc, // format-string fmt, const Args&... args); diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.pass.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // size_t formatted_size(format-string fmt, const Args&... args); // template @@ -22,7 +26,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h" diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.verify.cpp rename from libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.formatted_size.verify.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // size_t formatted_size(format-string fmt, const Args&... args); // template diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/P0645.tests.h rename from libcxx/test/std/utilities/format/format.functions/format_tests.h rename to libcxx/test/std/utilities/format/format.functions/P0645.tests.h --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/P0645.tests.h @@ -5,10 +5,12 @@ // //===----------------------------------------------------------------------===// -#ifndef TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_TESTS_H -#define TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_TESTS_H +#ifndef TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_P0645_TESTS_H +#define TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_P0645_TESTS_H -#include +// Contains the test for the formatters introduced in the original paper P0645 +// and minor improvements of this paper. The range based formatters are tested +// in the P2286 tests. #include #include @@ -17,36 +19,14 @@ #include #include -#include "make_string.h" #include "string_literal.h" #include "test_macros.h" +#include "format.functions.common.h" // In this file the following template types are used: // TestFunction must be callable as check(expected-result, string-to-format, args-to-format...) // ExceptionTest must be callable as check_exception(expected-exception, string-to-format, args-to-format...) -#define STR(S) MAKE_STRING(CharT, S) -#define SV(S) MAKE_STRING_VIEW(CharT, S) -#define CSTR(S) MAKE_CSTRING(CharT, S) - -template -struct context {}; - -template <> -struct context { - using type = std::format_context; -}; - -#ifndef TEST_HAS_NO_WIDE_CHARACTERS -template <> -struct context { - using type = std::wformat_context; -}; -#endif - -template -using context_t = typename context::type; - // A user-defined type used to test the handle formatter. enum class status : uint16_t { foo = 0xAAAA, bar = 0x5555, foobar = 0xAA55 }; @@ -2868,4 +2848,4 @@ } #endif -#endif +#endif // TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_P0645_TESTS_H diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.vformat.locale.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.vformat.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.vformat.locale.pass.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // string vformat(const locale& loc, string_view fmt, format_args args); // wstring vformat(const locale& loc, wstring_view fmt, wformat_args args); @@ -21,7 +25,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" auto test = []( diff --git a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.vformat.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.vformat.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.vformat.pass.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // string vformat(string_view fmt, format_args args); // wstring vformat(wstring_view fmt, wformat_args args); @@ -20,8 +24,9 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" + auto test = []( std::basic_string_view expected, std::basic_string_view fmt, Args&&... args) constexpr { std::basic_string out = std::vformat(fmt, std::make_format_args>(args...)); diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.vformat_to.locale.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.vformat_to.locale.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat_to.locale.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.vformat_to.locale.pass.cpp @@ -13,6 +13,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // Out vformat_to(Out out, const locale& loc, string_view fmt, // format_args args); @@ -27,7 +31,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" auto test = []( diff --git a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp b/libcxx/test/std/utilities/format/format.functions/P0645.vformat_to.pass.cpp rename from libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp rename to libcxx/test/std/utilities/format/format.functions/P0645.vformat_to.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/vformat_to.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/P0645.vformat_to.pass.cpp @@ -12,6 +12,10 @@ // +// This tests the formatters introduced in the original paper P0645 and minor +// improvements of this paper. The range based formatters are tested in the +// P2286 tests. + // template // Out vformat_to(Out out, string_view fmt, format_args args); // template @@ -24,7 +28,7 @@ #include #include "test_macros.h" -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" auto test = []( diff --git a/libcxx/test/std/utilities/format/format.functions/format.functions.common.h b/libcxx/test/std/utilities/format/format.functions/format.functions.common.h new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/format/format.functions/format.functions.common.h @@ -0,0 +1,39 @@ +//===----------------------------------------------------------------------===// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_FUNCTIONS_COMMON_H +#define TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_FUNCTIONS_COMMON_H + +// Contains the common part of the formatter tests for different papers. + +#include + +#include "make_string.h" + +#define STR(S) MAKE_STRING(CharT, S) +#define SV(S) MAKE_STRING_VIEW(CharT, S) +#define CSTR(S) MAKE_CSTRING(CharT, S) + +template +struct context {}; + +template <> +struct context { + using type = std::format_context; +}; + +#ifndef TEST_HAS_NO_WIDE_CHARACTERS +template <> +struct context { + using type = std::wformat_context; +}; +#endif + +template +using context_t = typename context::type; + +#endif // TEST_STD_UTILITIES_FORMAT_FORMAT_FUNCTIONS_FORMAT_FUNCTIONS_COMMON_H diff --git a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/locale-specific_form.pass.cpp @@ -90,7 +90,7 @@ #include "test_macros.h" #include "make_string.h" #include "platform_support.h" // locale name macros -#include "format_tests.h" +#include "P0645.tests.h" #include "string_literal.h" #include "test_format_string.h"