[libcxx-commits] [PATCH] D139126: [NFC][libc++][chrono] Improves test coverage.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 21 08:53:39 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0df9a72f283a: [NFC][libc++][chrono] Improves test coverage. (authored by Mordante).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139126/new/

https://reviews.llvm.org/D139126

Files:
  libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp


Index: libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp
===================================================================
--- libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp
+++ libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/op.sys_days.pass.cpp
@@ -70,5 +70,14 @@
     assert( year_month_weekday{sd} == ymwd); // and back
     }
 
+    {
+    // Index 0 returns 7 weekdays before index 1 and can't be round-tripped.
+    constexpr year_month_weekday ymwd{year{2000}, month{2}, weekday_indexed{std::chrono::Wednesday, 0}};
+    constexpr sys_days sd{ymwd};
+
+    static_assert(sd.time_since_epoch() == days{10957 + 25});
+    static_assert(year_month_weekday{sd} != ymwd); // and back fails
+    }
+
     return 0;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139126.484598.patch
Type: text/x-patch
Size: 817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221221/f9ead431/attachment-0001.bin>


More information about the libcxx-commits mailing list