[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.member.ops / divide_equal_complex.pass.cpp
blob989177b25bff9642c03e7b4b5470094bb39e92c7
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(-4, 7.5);
23 const std::complex<T> c2(1.5, 2.5);
24 assert(c.real() == -4);
25 assert(c.imag() == 7.5);
26 c /= c2;
27 assert(c.real() == 1.5);
28 assert(c.imag() == 2.5);
29 c /= c2;
30 assert(c.real() == 1);
31 assert(c.imag() == 0);
33 std::complex<T> c3;
35 c3 = c;
36 std::complex<int> ic (1,1);
37 c3 /= ic;
38 assert(c3.real() == 0.5);
39 assert(c3.imag() == -0.5);
41 c3 = c;
42 std::complex<float> fc (1,1);
43 c3 /= fc;
44 assert(c3.real() == 0.5);
45 assert(c3.imag() == -0.5);
49 int main(int, char**)
51 test<float>();
52 test<double>();
53 test<long double>();
55 return 0;