• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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& rhs);
13 
14 #include <complex>
15 #include <cassert>
16 
17 template <class T>
18 void
test()19 test()
20 {
21     std::complex<T> c(1);
22     assert(c.real() == 1);
23     assert(c.imag() == 0);
24     c /= 0.5;
25     assert(c.real() == 2);
26     assert(c.imag() == 0);
27     c /= 0.5;
28     assert(c.real() == 4);
29     assert(c.imag() == 0);
30     c /= -0.5;
31     assert(c.real() == -8);
32     assert(c.imag() == 0);
33     c.imag(2);
34     c /= 0.5;
35     assert(c.real() == -16);
36     assert(c.imag() == 4);
37 }
38 
main()39 int main()
40 {
41     test<float>();
42     test<double>();
43     test<long double>();
44 }
45