libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

comparisons.pass.cpp (1460B)


      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 // constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
     15 // constexpr bool operator!=(const weekday& x, const weekday& y) noexcept;
     16 
     17 
     18 #include <chrono>
     19 #include <type_traits>
     20 #include <cassert>
     21 
     22 #include "test_macros.h"
     23 #include "test_comparisons.h"
     24 
     25 int main()
     26 {
     27     using weekday      = std::chrono::weekday;
     28     using weekday_last = std::chrono::weekday_last;
     29 
     30     AssertComparisons2AreNoexcept<weekday_last>();
     31     AssertComparisons2ReturnBool<weekday_last>();
     32 
     33     static_assert(testComparisons2Values<weekday_last>(weekday{0}, weekday{0}), "");
     34     static_assert(testComparisons2Values<weekday_last>(weekday{0}, weekday{1}), "");
     35 
     36 //  Some 'ok' values as well
     37     static_assert(testComparisons2Values<weekday_last>(weekday{2}, weekday{2}), "");
     38     static_assert(testComparisons2Values<weekday_last>(weekday{2}, weekday{3}), "");
     39 
     40     for (unsigned i = 0; i < 6; ++i)
     41         for (unsigned j = 0; j < 6; ++j)
     42             assert(testComparisons2Values<weekday_last>(weekday{i}, weekday{j}));
     43 }