diff options
Diffstat (limited to 'libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp')
| -rw-r--r-- | libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp new file mode 100644 index 00000000000..acaca806a21 --- /dev/null +++ b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp @@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// <chrono> +// class weekday_indexed; + +// constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; +// Returns: x.weekday() == y.weekday() && x.index() == y.index(). +// constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept; +// Returns: !(x == y) + +#include <chrono> +#include <type_traits> +#include <cassert> + +#include "test_macros.h" +#include "test_comparisons.h" + +int main() +{ + using weekday = std::chrono::weekday; + using weekday_indexed = std::chrono::weekday_indexed; + + AssertComparisons2AreNoexcept<weekday_indexed>(); + AssertComparisons2ReturnBool<weekday_indexed>(); + + static_assert( (weekday_indexed{} == weekday_indexed{}), ""); + static_assert(!(weekday_indexed{} != weekday_indexed{}), ""); + + static_assert(!(weekday_indexed{} == weekday_indexed{std::chrono::Tuesday, 1}), ""); + static_assert( (weekday_indexed{} != weekday_indexed{std::chrono::Tuesday, 1}), ""); + +// Some 'ok' values as well + static_assert( (weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 2}), ""); + static_assert(!(weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 2}), ""); + + static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 1}), ""); + static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 1}), ""); + static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{2}, 2}), ""); + static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{2}, 2}), ""); +} |

