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(1); 22 assert(c.real() == 1); 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() == 2.25); 29 assert(c.imag() == 0); 30 c *= -1.5; 31 assert(c.real() == -3.375); 32 assert(c.imag() == 0); 33 c.imag(2); 34 c *= 1.5; 35 assert(c.real() == -5.0625); 36 assert(c.imag() == 3); 37} 38 39int main() 40{ 41 test<float>(); 42 test<double>(); 43 test<long double>(); 44} 45