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