Move test into test/std subdirectory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
12
test/std/utilities/time/time.traits/nothing_to_do.pass.cpp
Normal file
12
test/std/utilities/time/time.traits/nothing_to_do.pass.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <chrono>
|
||||
|
||||
// duration_values::max
|
||||
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../rep.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(std::chrono::duration_values<int>::max() ==
|
||||
std::numeric_limits<int>::max());
|
||||
assert(std::chrono::duration_values<double>::max() ==
|
||||
std::numeric_limits<double>::max());
|
||||
assert(std::chrono::duration_values<Rep>::max() ==
|
||||
std::numeric_limits<Rep>::max());
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
static_assert(std::chrono::duration_values<int>::max() ==
|
||||
std::numeric_limits<int>::max(), "");
|
||||
static_assert(std::chrono::duration_values<double>::max() ==
|
||||
std::numeric_limits<double>::max(), "");
|
||||
static_assert(std::chrono::duration_values<Rep>::max() ==
|
||||
std::numeric_limits<Rep>::max(), "");
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <chrono>
|
||||
|
||||
// duration_values::min
|
||||
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../rep.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(std::chrono::duration_values<int>::min() ==
|
||||
std::numeric_limits<int>::lowest());
|
||||
assert(std::chrono::duration_values<double>::min() ==
|
||||
std::numeric_limits<double>::lowest());
|
||||
assert(std::chrono::duration_values<Rep>::min() ==
|
||||
std::numeric_limits<Rep>::lowest());
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
static_assert(std::chrono::duration_values<int>::min() ==
|
||||
std::numeric_limits<int>::lowest(), "");
|
||||
static_assert(std::chrono::duration_values<double>::min() ==
|
||||
std::numeric_limits<double>::lowest(), "");
|
||||
static_assert(std::chrono::duration_values<Rep>::min() ==
|
||||
std::numeric_limits<Rep>::lowest(), "");
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <chrono>
|
||||
|
||||
// duration_values::zero
|
||||
|
||||
#include <chrono>
|
||||
#include <cassert>
|
||||
|
||||
#include "../../rep.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
assert(std::chrono::duration_values<int>::zero() == 0);
|
||||
assert(std::chrono::duration_values<Rep>::zero() == 0);
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
static_assert(std::chrono::duration_values<int>::zero() == 0, "");
|
||||
static_assert(std::chrono::duration_values<Rep>::zero() == 0, "");
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <chrono>
|
||||
|
||||
// treat_as_floating_point
|
||||
|
||||
#include <chrono>
|
||||
#include <type_traits>
|
||||
|
||||
template <class T>
|
||||
void
|
||||
test()
|
||||
{
|
||||
static_assert((std::is_base_of<std::is_floating_point<T>,
|
||||
std::chrono::treat_as_floating_point<T> >::value), "");
|
||||
}
|
||||
|
||||
struct A {};
|
||||
|
||||
int main()
|
||||
{
|
||||
test<int>();
|
||||
test<unsigned>();
|
||||
test<char>();
|
||||
test<bool>();
|
||||
test<float>();
|
||||
test<double>();
|
||||
test<long double>();
|
||||
test<A>();
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <chrono>
|
||||
|
||||
// template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
// struct common_type<chrono::duration<Rep1, Period1>, chrono::duration<Rep2, Period2>>
|
||||
// {
|
||||
// typedef chrono::duration<typename common_type<Rep1, Rep2>::type, see below }> type;
|
||||
// };
|
||||
|
||||
#include <chrono>
|
||||
|
||||
template <class D1, class D2, class De>
|
||||
void
|
||||
test()
|
||||
{
|
||||
typedef typename std::common_type<D1, D2>::type Dc;
|
||||
static_assert((std::is_same<Dc, De>::value), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<std::chrono::duration<int, std::ratio<1, 100> >,
|
||||
std::chrono::duration<long, std::ratio<1, 1000> >,
|
||||
std::chrono::duration<long, std::ratio<1, 1000> > >();
|
||||
test<std::chrono::duration<long, std::ratio<1, 100> >,
|
||||
std::chrono::duration<int, std::ratio<1, 1000> >,
|
||||
std::chrono::duration<long, std::ratio<1, 1000> > >();
|
||||
test<std::chrono::duration<char, std::ratio<1, 30> >,
|
||||
std::chrono::duration<short, std::ratio<1, 1000> >,
|
||||
std::chrono::duration<int, std::ratio<1, 3000> > >();
|
||||
test<std::chrono::duration<double, std::ratio<21, 1> >,
|
||||
std::chrono::duration<short, std::ratio<15, 1> >,
|
||||
std::chrono::duration<double, std::ratio<3, 1> > >();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <chrono>
|
||||
|
||||
// template <class Clock, class Duration1, class Duration2>
|
||||
// struct common_type<chrono::time_point<Clock, Duration1>, chrono::time_point<Clock, Duration2>>
|
||||
// {
|
||||
// typedef chrono::time_point<Clock, typename common_type<Duration1, Duration2>::type> type;
|
||||
// };
|
||||
|
||||
#include <chrono>
|
||||
|
||||
template <class D1, class D2, class De>
|
||||
void
|
||||
test()
|
||||
{
|
||||
typedef std::chrono::system_clock C;
|
||||
typedef std::chrono::time_point<C, D1> T1;
|
||||
typedef std::chrono::time_point<C, D2> T2;
|
||||
typedef std::chrono::time_point<C, De> Te;
|
||||
typedef typename std::common_type<T1, T2>::type Tc;
|
||||
static_assert((std::is_same<Tc, Te>::value), "");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<std::chrono::duration<int, std::ratio<1, 100> >,
|
||||
std::chrono::duration<long, std::ratio<1, 1000> >,
|
||||
std::chrono::duration<long, std::ratio<1, 1000> > >();
|
||||
test<std::chrono::duration<long, std::ratio<1, 100> >,
|
||||
std::chrono::duration<int, std::ratio<1, 1000> >,
|
||||
std::chrono::duration<long, std::ratio<1, 1000> > >();
|
||||
test<std::chrono::duration<char, std::ratio<1, 30> >,
|
||||
std::chrono::duration<short, std::ratio<1, 1000> >,
|
||||
std::chrono::duration<int, std::ratio<1, 3000> > >();
|
||||
test<std::chrono::duration<double, std::ratio<21, 1> >,
|
||||
std::chrono::duration<short, std::ratio<15, 1> >,
|
||||
std::chrono::duration<double, std::ratio<3, 1> > >();
|
||||
}
|
||||
Reference in New Issue
Block a user