• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
10 
11 // <chrono>
12 // class weekday_last;
13 
14 //  explicit constexpr weekday_last(const chrono::weekday& wd) noexcept;
15 //
16 //  Effects: Constructs an object of type weekday_last by initializing wd_ with wd.
17 //
18 //  constexpr chrono::weekday weekday() const noexcept;
19 //  constexpr bool ok() const noexcept;
20 
21 #include <chrono>
22 #include <type_traits>
23 #include <cassert>
24 
25 #include "test_macros.h"
26 
main()27 int main()
28 {
29     using weekday      = std::chrono::weekday;
30     using weekday_last = std::chrono::weekday_last;
31 
32     ASSERT_NOEXCEPT(weekday_last{weekday{}});
33 
34     constexpr weekday_last wdl0{weekday{}};
35     static_assert( wdl0.weekday() == weekday{}, "");
36     static_assert( wdl0.ok(),                   "");
37 
38     constexpr weekday_last wdl1 {weekday{1}};
39     static_assert( wdl1.weekday() == weekday{1}, "");
40     static_assert( wdl1.ok(),                    "");
41 
42     for (unsigned i = 0; i <= 255; ++i)
43     {
44         weekday_last wdl{weekday{i}};
45         assert(wdl.weekday() == weekday{i});
46     }
47 }
48