brintos

brintos / llvm-project-archived public Read only

0
0
Text · 995 B · d24673c Raw
45 lines · cpp
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-exception6//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#include "test_macros.h"19 20template <class T>21void22test(const std::complex<T>& z, std::complex<T> x)23{24    assert(conj(z) == x);25}26 27template <class T>28void29test()30{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    test(std::complex<T>(-1, -2), std::complex<T>(-1, 2));35}36 37int main(int, char**)38{39    test<float>();40    test<double>();41    test<long double>();42 43  return 0;44}45