xref: /llvm-project/libcxx/test/std/time/time.duration/time.duration.cons/default.pass.cpp (revision 7738db2c06b177fe916ac1bcf3633449b3c1fca9)
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 //===----------------------------------------------------------------------===//
8 
9 // <chrono>
10 
11 // duration
12 
13 // duration() = default;
14 
15 // Rep must be default initialized, not initialized with 0
16 
17 #include <chrono>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 #include "../../rep.h"
22 
23 template <class D>
24 void
test()25 test()
26 {
27     D d;
28     assert(d.count() == typename D::rep());
29 #if TEST_STD_VER >= 11
30     constexpr D d2 = D();
31     static_assert(d2.count() == typename D::rep(), "");
32 #endif
33 }
34 
main(int,char **)35 int main(int, char**)
36 {
37     test<std::chrono::duration<Rep> >();
38 
39   return 0;
40 }
41