[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.member.ops / times_equal_complex.pass.cpp
blobaabe9229cb52a996ac4cd5e7f343a0b1885a1122
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 // complex& operator*=(const complex& rhs);
13 #include <complex>
14 #include <cassert>
16 #include "test_macros.h"
18 template <class T>
19 void
20 test()
22 std::complex<T> c(1);
23 const std::complex<T> c2(1.5, 2.5);
24 assert(c.real() == 1);
25 assert(c.imag() == 0);
26 c *= c2;
27 assert(c.real() == 1.5);
28 assert(c.imag() == 2.5);
29 c *= c2;
30 assert(c.real() == -4);
31 assert(c.imag() == 7.5);
33 std::complex<T> c3;
35 c3 = c;
36 std::complex<int> ic (1,1);
37 c3 *= ic;
38 assert(c3.real() == -11.5);
39 assert(c3.imag() == 3.5);
41 c3 = c;
42 std::complex<float> fc (1,1);
43 c3 *= fc;
44 assert(c3.real() == -11.5);
45 assert(c3.imag() == 3.5);
48 int main(int, char**)
50 test<float>();
51 test<double>();
52 test<long double>();
54 return 0;