• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
10 // <chrono>
11 
12 // duration
13 
14 // duration& operator-=(const duration& d);
15 
16 #include <chrono>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 
21 #if TEST_STD_VER > 14
test_constexpr()22 constexpr bool test_constexpr()
23 {
24     std::chrono::seconds s(3);
25     s -= std::chrono::seconds(2);
26     if (s.count() != 1) return false;
27     s -= std::chrono::minutes(2);
28     return s.count() == -119;
29 }
30 #endif
31 
main()32 int main()
33 {
34     {
35     std::chrono::seconds s(3);
36     s -= std::chrono::seconds(2);
37     assert(s.count() == 1);
38     s -= std::chrono::minutes(2);
39     assert(s.count() == -119);
40     }
41 
42 #if TEST_STD_VER > 14
43     static_assert(test_constexpr(), "");
44 #endif
45 }
46