1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <complex>
11
12 // template<class T>
13 // bool
14 // operator==(const complex<T>& lhs, const complex<T>& rhs);
15
16 #include <complex>
17 #include <cassert>
18
19 #include "test_macros.h"
20
21 template <class T>
22 void
test_constexpr()23 test_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
39 template <class T>
40 void
test()41 test()
42 {
43 {
44 std::complex<T> lhs(1.5, 2.5);
45 std::complex<T> rhs(1.5, -2.5);
46 assert( !(lhs == rhs));
47 }
48 {
49 std::complex<T> lhs(1.5, 2.5);
50 std::complex<T> rhs(1.5, 2.5);
51 assert(lhs == rhs);
52 }
53 test_constexpr<T> ();
54 }
55
main()56 int main()
57 {
58 test<float>();
59 test<double>();
60 test<long double>();
61 // test_constexpr<int> ();
62 }
63