Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / time / time.traits / time.traits.specializations / duration.pass.cpp
blob8b1b589866258e77a8cd20b3d812afd8e683d9eb
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 Rep1, class Period1, class Rep2, class Period2>
12 // struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>
13 // {
14 // typedef chrono::duration<typename common_type<Rep1, Rep2>::type, see below }> 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 typename std::common_type<D1, D2>::type Dc;
28 static_assert((std::is_same<Dc, De>::value), "");
31 int main(int, char**)
33 test<std::chrono::duration<int, std::ratio<1, 100> >,
34 std::chrono::duration<long, std::ratio<1, 1000> >,
35 std::chrono::duration<long, std::ratio<1, 1000> > >();
36 test<std::chrono::duration<long, std::ratio<1, 100> >,
37 std::chrono::duration<int, std::ratio<1, 1000> >,
38 std::chrono::duration<long, std::ratio<1, 1000> > >();
39 test<std::chrono::duration<char, std::ratio<1, 30> >,
40 std::chrono::duration<short, std::ratio<1, 1000> >,
41 std::chrono::duration<int, std::ratio<1, 3000> > >();
42 test<std::chrono::duration<double, std::ratio<21, 1> >,
43 std::chrono::duration<short, std::ratio<15, 1> >,
44 std::chrono::duration<double, std::ratio<3, 1> > >();
46 return 0;