Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.member.ops / divide_equal_scalar.pass.cpp
blob9251fb4f1bfebe59d80f173fbc79bd611cdda608
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 T& rhs); // constexpr in C++20
13 #include <complex>
14 #include <cassert>
16 #include "test_macros.h"
18 template <class T>
19 TEST_CONSTEXPR_CXX20
20 bool
21 test()
23 std::complex<T> c(1);
24 assert(c.real() == 1);
25 assert(c.imag() == 0);
26 c /= 0.5;
27 assert(c.real() == 2);
28 assert(c.imag() == 0);
29 c /= 0.5;
30 assert(c.real() == 4);
31 assert(c.imag() == 0);
32 c /= -0.5;
33 assert(c.real() == -8);
34 assert(c.imag() == 0);
35 c.imag(2);
36 c /= 0.5;
37 assert(c.real() == -16);
38 assert(c.imag() == 4);
39 return true;
42 int main(int, char**)
44 test<float>();
45 test<double>();
46 test<long double>();
48 #if TEST_STD_VER >= 20
49 static_assert(test<float>());
50 static_assert(test<double>());
51 static_assert(test<long double>());
52 #endif
54 return 0;