1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <complex> 10 11 // complex& operator= (const T&); 12 13 #include <complex> 14 #include <cassert> 15 16 #include "test_macros.h" 17 18 template <class T> 19 void test()20test() 21 { 22 std::complex<T> c; 23 assert(c.real() == 0); 24 assert(c.imag() == 0); 25 c = 1.5; 26 assert(c.real() == 1.5); 27 assert(c.imag() == 0); 28 c = -1.5; 29 assert(c.real() == -1.5); 30 assert(c.imag() == 0); 31 } 32 main(int,char **)33int main(int, char**) 34 { 35 test<float>(); 36 test<double>(); 37 test<long double>(); 38 39 return 0; 40 } 41