brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 0562aaa Raw
49 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8// UNSUPPORTED: c++03, c++11, c++14, c++179 10// <chrono>11// class weekday_last;12 13//  explicit constexpr weekday_last(const chrono::weekday& wd) noexcept;14//15//  Effects: Constructs an object of type weekday_last by initializing wd_ with wd.16//17//  constexpr chrono::weekday weekday() const noexcept;18//  constexpr bool ok() const noexcept;19 20#include <chrono>21#include <type_traits>22#include <cassert>23 24#include "test_macros.h"25 26int main(int, char**)27{28    using weekday      = std::chrono::weekday;29    using weekday_last = std::chrono::weekday_last;30 31    ASSERT_NOEXCEPT(weekday_last{weekday{}});32 33    constexpr weekday_last wdl0{weekday{}};34    static_assert( wdl0.weekday() == weekday{}, "");35    static_assert( wdl0.ok(),                   "");36 37    constexpr weekday_last wdl1 {weekday{1}};38    static_assert( wdl1.weekday() == weekday{1}, "");39    static_assert( wdl1.ok(),                    "");40 41    for (unsigned i = 0; i <= 255; ++i)42    {43        weekday_last wdl{weekday{i}};44        assert(wdl.weekday() == weekday{i});45    }46 47  return 0;48}49