Files
libcxx/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+=.pass.cpp
Stephan T. Lavavej 5d91f314f1 [libcxx] [test] Change comments to say C++ instead of c++. NFC.
This makes them consistent (many comments already used uppercase).

The special REQUIRES, UNSUPPORTED, and XFAIL comments are excluded from this change.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@309468 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29 00:55:35 +00:00

46 lines
1011 B
C++

//===----------------------------------------------------------------------===//
//
// 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
// constexpr duration& operator+=(const duration& d); // constexpr in C++17
#include <chrono>
#include <cassert>
#include "test_macros.h"
#if TEST_STD_VER > 14
constexpr bool test_constexpr()
{
std::chrono::seconds s(3);
s += std::chrono::seconds(2);
if (s.count() != 5) return false;
s += std::chrono::minutes(2);
return s.count() == 125;
}
#endif
int main()
{
{
std::chrono::seconds s(3);
s += std::chrono::seconds(2);
assert(s.count() == 5);
s += std::chrono::minutes(2);
assert(s.count() == 125);
}
#if TEST_STD_VER > 14
static_assert(test_constexpr(), "");
#endif
}