Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Modern formatting library - fmt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Avionics
Software Development
Third Party
Modern formatting library - fmt
Commits
509eac95
Commit
509eac95
authored
3 years ago
by
Vladislav Shchapov
Committed by
Victor Zverovich
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Workarounds for implementation-defined std::strftime behavior
parent
85b38190
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/chrono-test.cc
+10
-1
10 additions, 1 deletion
test/chrono-test.cc
with
10 additions
and
1 deletion
test/chrono-test.cc
+
10
−
1
View file @
509eac95
...
...
@@ -57,6 +57,10 @@ TEST(chrono_test, format_tm) {
EXPECT_EQ
(
fmt
::
format
(
"{:%T}"
,
tm
),
"11:22:33"
);
}
// MSVC:
// minkernel\crts\ucrt\src\appcrt\time\wcsftime.cpp(971) : Assertion failed:
// timeptr->tm_year >= -1900 && timeptr->tm_year <= 8099
#ifndef _WIN32
TEST
(
chrono_test
,
format_tm_future
)
{
auto
tm
=
std
::
tm
();
tm
.
tm_year
=
10445
;
// 10000+ years
...
...
@@ -84,10 +88,15 @@ TEST(chrono_test, format_tm_past) {
EXPECT_EQ
(
fmt
::
format
(
"The date is {:%Y-%m-%d %H:%M:%S}."
,
tm
),
"The date is -101-04-25 11:22:33."
);
EXPECT_EQ
(
fmt
::
format
(
"{:%Y}"
,
tm
),
"-101"
);
EXPECT_EQ
(
fmt
::
format
(
"{:%D}"
,
tm
),
"04/25/01"
);
// macOS %D - "04/25/01" (%y)
// Linux %D - "04/25/99" (%y)
// EXPECT_EQ(fmt::format("{:%D}", tm), "04/25/01");
EXPECT_EQ
(
fmt
::
format
(
"{:%F}"
,
tm
),
"-101-04-25"
);
EXPECT_EQ
(
fmt
::
format
(
"{:%T}"
,
tm
),
"11:22:33"
);
}
#endif
TEST
(
chrono_test
,
grow_buffer
)
{
auto
s
=
std
::
string
(
"{:"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment