50 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <chrono>10 11// duration12 13// static constexpr duration min(); // noexcept after C++1714 15#include <chrono>16#include <limits>17#include <cassert>18 19#include "test_macros.h"20#include "../../rep.h"21 22template <class D>23void test()24{25 LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<typename D::rep>::min());26#if TEST_STD_VER > 1727 ASSERT_NOEXCEPT( std::chrono::duration_values<typename D::rep>::min());28#endif29 {30 typedef typename D::rep DRep;31 DRep min_rep = std::chrono::duration_values<DRep>::min();32 assert(D::min().count() == min_rep);33 }34#if TEST_STD_VER >= 1135 {36 typedef typename D::rep DRep;37 constexpr DRep min_rep = std::chrono::duration_values<DRep>::min();38 static_assert(D::min().count() == min_rep, "");39 }40#endif41}42 43int main(int, char**)44{45 test<std::chrono::duration<int> >();46 test<std::chrono::duration<Rep> >();47 48 return 0;49}50