libcxx

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

treat_as_floating_point.pass.cpp (1003B)


      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 // treat_as_floating_point
     13 
     14 #include <chrono>
     15 #include <type_traits>
     16 
     17 #include "test_macros.h"
     18 
     19 template <class T>
     20 void
     21 test()
     22 {
     23     static_assert((std::is_base_of<std::is_floating_point<T>,
     24                                    std::chrono::treat_as_floating_point<T> >::value), "");
     25 #if TEST_STD_VER > 14
     26     static_assert(std::is_floating_point<T>::value ==
     27                                   std::chrono::treat_as_floating_point_v<T>, "");
     28 #endif
     29 }
     30 
     31 struct A {};
     32 
     33 int main()
     34 {
     35     test<int>();
     36     test<unsigned>();
     37     test<char>();
     38     test<bool>();
     39     test<float>();
     40     test<double>();
     41     test<long double>();
     42     test<A>();
     43 }