comparisons.pass.cpp (1313B)
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 day; 13 14 // constexpr bool operator==(const day& x, const day& y) noexcept; 15 // Returns: unsigned{x} == unsigned{y}. 16 // constexpr bool operator<(const day& x, const day& y) noexcept; 17 // Returns: unsigned{x} < unsigned{y}. 18 19 20 #include <chrono> 21 #include <type_traits> 22 #include <cassert> 23 24 #include "test_macros.h" 25 #include "test_comparisons.h" 26 27 int main() 28 { 29 using day = std::chrono::day; 30 31 AssertComparisons6AreNoexcept<day>(); 32 AssertComparisons6ReturnBool<day>(); 33 34 static_assert(testComparisons6Values<day>(0U, 0U), ""); 35 static_assert(testComparisons6Values<day>(0U, 1U), ""); 36 37 // Some 'ok' values as well 38 static_assert(testComparisons6Values<day>( 5U, 5U), ""); 39 static_assert(testComparisons6Values<day>( 5U, 10U), ""); 40 41 for (unsigned i = 1; i < 10; ++i) 42 for (unsigned j = 1; j < 10; ++j) 43 assert(testComparisons6Values<day>(i, j)); 44 }