[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.ops / scalar_equals_complex.pass.cpp
blob4fe46bb3700414793b7aa204da0fc06d3be4af6c
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 //===----------------------------------------------------------------------===//
9 // <complex>
11 // template<class T>
12 // bool
13 // operator==(const T& lhs, const complex<T>& rhs);
15 #include <complex>
16 #include <cassert>
18 #include "test_macros.h"
20 template <class T>
21 TEST_CONSTEXPR_CXX20
22 void
23 test_constexpr()
25 #if TEST_STD_VER > 11
27 constexpr T lhs(-2.5);
28 constexpr std::complex<T> rhs(1.5, 2.5);
29 static_assert(!(lhs == rhs), "");
32 constexpr T lhs(-2.5);
33 constexpr std::complex<T> rhs(1.5, 0);
34 static_assert(!(lhs == rhs), "");
37 constexpr T lhs(1.5);
38 constexpr std::complex<T> rhs(1.5, 2.5);
39 static_assert(!(lhs == rhs), "");
42 constexpr T lhs(1.5);
43 constexpr std::complex<T> rhs(1.5, 0);
44 static_assert(lhs == rhs, "");
46 #endif
49 template <class T>
50 TEST_CONSTEXPR_CXX20
51 bool
52 test()
55 T lhs(-2.5);
56 std::complex<T> rhs(1.5, 2.5);
57 assert(!(lhs == rhs));
60 T lhs(-2.5);
61 std::complex<T> rhs(1.5, 0);
62 assert(!(lhs == rhs));
65 T lhs(1.5);
66 std::complex<T> rhs(1.5, 2.5);
67 assert(!(lhs == rhs));
70 T lhs(1.5);
71 std::complex<T> rhs(1.5, 0);
72 assert(lhs == rhs);
75 test_constexpr<T> ();
76 return true;
79 int main(int, char**)
81 test<float>();
82 test<double>();
83 test<long double>();
85 #if TEST_STD_VER > 17
86 static_assert(test<float>());
87 static_assert(test<double>());
88 static_assert(test<long double>());
89 #endif
91 return 0;