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// bool
13// operator!=(const complex<T>& lhs, const complex<T>& rhs);
14
15#include <complex>
16#include <cassert>
17
18#include "test_macros.h"
19
20template <class T>
21TEST_CONSTEXPR_CXX20
22void
23test_constexpr()
24{
25#if TEST_STD_VER > 11
26 {
27 constexpr std::complex<T> lhs(1.5, 2.5);
28 constexpr std::complex<T> rhs(1.5, -2.5);
29 static_assert(lhs != rhs, "");
30 }
31 {
32 constexpr std::complex<T> lhs(1.5, 2.5);
33 constexpr std::complex<T> rhs(1.5, 2.5);
34 static_assert(!(lhs != rhs), "" );
35 }
36#endif
37}
38
39template <class T>
40TEST_CONSTEXPR_CXX20
41bool
42test()
43{
44 {
45 const std::complex<T> lhs(1.5, 2.5);
46 const std::complex<T> rhs(1.5, -2.5);
47 assert(lhs != rhs);
48 }
49 {
50 const std::complex<T> lhs(1.5, 2.5);
51 const std::complex<T> rhs(1.5, 2.5);
52 assert(!(lhs != rhs));
53 }
54
55 test_constexpr<T> ();
56 return true;
57}
58
59int main(int, char**)
60{
61 test<float>();
62 test<double>();
63 test<long double>();
64
65#if TEST_STD_VER > 17
66 static_assert(test<float>());
67 static_assert(test<double>());
68 static_assert(test<long double>());
69#endif
70
71 return 0;
72}
73

source code of libcxx/test/std/numerics/complex.number/complex.ops/complex_not_equals_complex.pass.cpp