libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

op_times=.pass.cpp (803B)


      1 //===----------------------------------------------------------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 // <chrono>
     11 
     12 // duration
     13 
     14 // duration& operator*=(const rep& rhs);
     15 
     16 #include <chrono>
     17 #include <cassert>
     18 
     19 #include "test_macros.h"
     20 
     21 #if TEST_STD_VER > 14
     22 constexpr bool test_constexpr()
     23 {
     24     std::chrono::seconds s(3);
     25     s *= 5;
     26     return s.count() == 15;
     27 }
     28 #endif
     29 
     30 int main()
     31 {
     32     {
     33     std::chrono::nanoseconds ns(3);
     34     ns *= 5;
     35     assert(ns.count() == 15);
     36     }
     37 
     38 #if TEST_STD_VER > 14
     39     static_assert(test_constexpr(), "");
     40 #endif
     41 }