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 // template<class T> 13 // complex<T> 14 // conj(const complex<T>& x); 15 16 #include <complex> 17 #include <cassert> 18 19 template <class T> 20 void 21 test(const std::complex<T>& z, std::complex<T> x) 22 { 23 assert(conj(z) == x); 24 } 25 26 template <class T> 27 void 28 test() 29 { 30 test(std::complex<T>(1, 2), std::complex<T>(1, -2)); 31 test(std::complex<T>(-1, 2), std::complex<T>(-1, -2)); 32 test(std::complex<T>(1, -2), std::complex<T>(1, 2)); 33 test(std::complex<T>(-1, -2), std::complex<T>(-1, 2)); 34 } 35 36 int main() 37 { 38 test<float>(); 39 test<double>(); 40 test<long double>(); 41 } 42