brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 4845fa8 Raw
45 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// constexpr bool operator==(const weekday& x, const weekday& y) noexcept;14// constexpr bool operator!=(const weekday& x, const weekday& y) noexcept;15 16 17#include <chrono>18#include <type_traits>19#include <cassert>20 21#include "test_macros.h"22#include "test_comparisons.h"23 24int main(int, char**)25{26    using weekday      = std::chrono::weekday;27    using weekday_last = std::chrono::weekday_last;28 29    AssertEqualityAreNoexcept<weekday_last>();30    AssertEqualityReturnBool<weekday_last>();31 32    static_assert(testEqualityValues<weekday_last>(weekday{0}, weekday{0}), "");33    static_assert(testEqualityValues<weekday_last>(weekday{0}, weekday{1}), "");34 35    //  Some 'ok' values as well36    static_assert(testEqualityValues<weekday_last>(weekday{2}, weekday{2}), "");37    static_assert(testEqualityValues<weekday_last>(weekday{2}, weekday{3}), "");38 39    for (unsigned i = 0; i < 6; ++i)40        for (unsigned j = 0; j < 6; ++j)41            assert(testEqualityValues<weekday_last>(weekday{i}, weekday{j}));42 43    return 0;44}45