Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / time / time.traits / time.traits.specializations / time_point.pass.cpp
blob181c3e00309483ee3a034d42e34faba2ccdce075
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 // template <class Clock, class Duration1, class Duration2>
12 // struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>
13 // {
14 // typedef chrono::time_point<Clock, typename common_type<Duration1, Duration2>::type> type;
15 // };
17 #include <chrono>
18 #include <ratio>
19 #include <type_traits>
21 #include "test_macros.h"
23 template <class D1, class D2, class De>
24 void
25 test()
27 typedef std::chrono::system_clock C;
28 typedef std::chrono::time_point<C, D1> T1;
29 typedef std::chrono::time_point<C, D2> T2;
30 typedef std::chrono::time_point<C, De> Te;
31 typedef typename std::common_type<T1, T2>::type Tc;
32 static_assert((std::is_same<Tc, Te>::value), "");
35 int main(int, char**)
37 test<std::chrono::duration<int, std::ratio<1, 100> >,
38 std::chrono::duration<long, std::ratio<1, 1000> >,
39 std::chrono::duration<long, std::ratio<1, 1000> > >();
40 test<std::chrono::duration<long, std::ratio<1, 100> >,
41 std::chrono::duration<int, std::ratio<1, 1000> >,
42 std::chrono::duration<long, std::ratio<1, 1000> > >();
43 test<std::chrono::duration<char, std::ratio<1, 30> >,
44 std::chrono::duration<short, std::ratio<1, 1000> >,
45 std::chrono::duration<int, std::ratio<1, 3000> > >();
46 test<std::chrono::duration<double, std::ratio<21, 1> >,
47 std::chrono::duration<short, std::ratio<15, 1> >,
48 std::chrono::duration<double, std::ratio<3, 1> > >();
50 return 0;