Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <chrono> |
| 11 | |
| 12 | // duration |
| 13 | |
| 14 | // duration& operator%=(const rep& rhs) |
| 15 | |
| 16 | #include <chrono> |
| 17 | #include <cassert> |
| 18 | |
Marshall Clow | 3df90c9 | 2017-01-04 23:03:24 +0000 | [diff] [blame] | 19 | #include "test_macros.h" |
| 20 | |
| 21 | #if TEST_STD_VER > 14 |
| 22 | constexpr bool test_constexpr() |
| 23 | { |
| 24 | std::chrono::seconds s(11); |
| 25 | s %= 3; |
| 26 | return s.count() == 2; |
| 27 | } |
| 28 | #endif |
| 29 | |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 30 | int main() |
| 31 | { |
Marshall Clow | 3df90c9 | 2017-01-04 23:03:24 +0000 | [diff] [blame] | 32 | { |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 33 | std::chrono::microseconds us(11); |
| 34 | us %= 3; |
| 35 | assert(us.count() == 2); |
Marshall Clow | 3df90c9 | 2017-01-04 23:03:24 +0000 | [diff] [blame] | 36 | } |
Stephan T. Lavavej | 51eb1be | 2017-01-07 01:12:15 +0000 | [diff] [blame^] | 37 | |
Marshall Clow | 3df90c9 | 2017-01-04 23:03:24 +0000 | [diff] [blame] | 38 | #if TEST_STD_VER > 14 |
| 39 | static_assert(test_constexpr(), ""); |
| 40 | #endif |
Howard Hinnant | c52f43e | 2010-08-22 00:59:46 +0000 | [diff] [blame] | 41 | } |