[clang][Driver][SPIR-V] Make tool names consistent (#122343)
[llvm-project.git] / libcxx / test / std / time / time.duration / time.duration.arithmetic / op_mod=rep.pass.cpp
blobf5ef512381af76f6d1a49e0b7fd08484f75d82ff
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <chrono>
11 // duration
13 // duration& operator%=(const rep& rhs)
15 #include <chrono>
16 #include <cassert>
18 #include "test_macros.h"
20 class NotARep {};
22 typedef std::chrono::seconds Duration;
23 Duration operator%=(Duration d, NotARep) { return d; }
25 #if TEST_STD_VER > 14
26 constexpr bool test_constexpr()
28 std::chrono::seconds s(11);
29 s %= 3;
30 return s.count() == 2;
32 #endif
34 int main(int, char**)
37 std::chrono::microseconds us(11);
38 us %= 3;
39 assert(us.count() == 2);
42 #if TEST_STD_VER > 14
43 static_assert(test_constexpr(), "");
44 #endif
46 #if TEST_STD_VER >= 11
47 { // This is PR#41130
48 Duration d(5);
49 NotARep n;
50 d %= n;
51 assert(d.count() == 5);
53 #endif
56 return 0;