Skip to content

Commit

Permalink
Add wchar_t test for gh_4320
Browse files Browse the repository at this point in the history
  • Loading branch information
Andor233 committed Aug 23, 2024
1 parent 2b3d3ec commit 70bb7fd
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions tests/std/tests/P0645R10_text_formatting_formatting/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1521,20 +1521,23 @@ void test_gh_4319() {
}

// GH-4320: <format>: crash when formatting a floating-point value with #/L and a large precision
template <class charT>
void test_gh_4320() {
assert(format("{:#.1075e}", 1.0)
== "1."
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000e+00");
assert(
format(STR("{:#.1075e}"), 1.0)
== STR(
"1."
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"00000000000000000000000000000000000e+00"));
}

void test() {
Expand Down Expand Up @@ -1621,7 +1624,8 @@ void test() {

test_gh_4319<char>();
test_gh_4319<wchar_t>();
test_gh_4320();
test_gh_4320<char>();
test_gh_4320<wchar_t>();
}

int main() {
Expand Down

0 comments on commit 70bb7fd

Please sign in to comment.