brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1018 B · b457619 Raw
47 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// duration& operator-=(const duration& d);14 15#include <chrono>16#include <cassert>17 18#include "test_macros.h"19 20#if TEST_STD_VER > 1421constexpr bool test_constexpr()22{23    std::chrono::seconds s(3);24    s -= std::chrono::seconds(2);25    if (s.count() != 1) return false;26    s -= std::chrono::minutes(2);27    return s.count() == -119;28}29#endif30 31int main(int, char**)32{33    {34    std::chrono::seconds s(3);35    s -= std::chrono::seconds(2);36    assert(s.count() == 1);37    s -= std::chrono::minutes(2);38    assert(s.count() == -119);39    }40 41#if TEST_STD_VER > 1442    static_assert(test_constexpr(), "");43#endif44 45  return 0;46}47