Home | History | Annotate | Download | only in complex.ops
      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 // <complex>
     11 
     12 // template<class T>
     13 //   bool
     14 //   operator!=(const complex<T>& lhs, const complex<T>& rhs);
     15 
     16 #include <complex>
     17 #include <cassert>
     18 
     19 #include "test_macros.h"
     20 
     21 template <class T>
     22 void
     23 test_constexpr()
     24 {
     25 #if TEST_STD_VER > 11
     26     {
     27     constexpr std::complex<T> lhs(1.5,  2.5);
     28     constexpr std::complex<T> rhs(1.5, -2.5);
     29     static_assert(lhs != rhs, "");
     30     }
     31     {
     32     constexpr std::complex<T> lhs(1.5, 2.5);
     33     constexpr std::complex<T> rhs(1.5, 2.5);
     34     static_assert(!(lhs != rhs), "" );
     35     }
     36 #endif
     37 }
     38 
     39 
     40 template <class T>
     41 void
     42 test()
     43 {
     44     {
     45     std::complex<T> lhs(1.5,  2.5);
     46     std::complex<T> rhs(1.5, -2.5);
     47     assert(lhs != rhs);
     48     }
     49     {
     50     std::complex<T> lhs(1.5, 2.5);
     51     std::complex<T> rhs(1.5, 2.5);
     52     assert(!(lhs != rhs));
     53     }
     54 
     55     test_constexpr<T> ();
     56     }
     57 
     58 int main()
     59 {
     60     test<float>();
     61     test<double>();
     62     test<long double>();
     63 //   test_constexpr<int> ();
     64 }
     65