Home | History | Annotate | Download | only in complex.member.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 // complex& operator= (const T&);
     13 
     14 #include <complex>
     15 #include <cassert>
     16 
     17 template <class T>
     18 void
     19 test()
     20 {
     21     std::complex<T> c;
     22     assert(c.real() == 0);
     23     assert(c.imag() == 0);
     24     c = 1.5;
     25     assert(c.real() == 1.5);
     26     assert(c.imag() == 0);
     27     c = -1.5;
     28     assert(c.real() == -1.5);
     29     assert(c.imag() == 0);
     30 }
     31 
     32 int main()
     33 {
     34     test<float>();
     35     test<double>();
     36     test<long double>();
     37 }
     38