libcxx

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

comparisons.pass.cpp (1281B)


      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;
     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 
     29     AssertComparisons2AreNoexcept<weekday>();
     30     AssertComparisons2ReturnBool<weekday>();
     31 
     32     static_assert(testComparisons2Values<weekday>(0U ,0U), "");
     33     static_assert(testComparisons2Values<weekday>(0U, 1U), "");
     34 
     35 //  Some 'ok' values as well
     36     static_assert(testComparisons2Values<weekday>(5U, 5U), "");
     37     static_assert(testComparisons2Values<weekday>(5U, 2U), "");
     38 
     39     for (unsigned i = 0; i < 6; ++i)
     40         for (unsigned j = 0; j < 6; ++j)
     41             assert(testComparisons2Values<weekday>(i, j));
     42 }