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
17template <class T>
18void
19test()
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() == 3);
29    assert(c.imag() == 0);
30    c += -1.5;
31    assert(c.real() == 1.5);
32    assert(c.imag() == 0);
33}
34
35int main()
36{
37    test<float>();
38    test<double>();
39    test<long double>();
40}
41