1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template<class T, class charT, class traits>
12 // basic_istream<charT, traits>&
13 // operator>>(basic_istream<charT, traits>& is, complex<T>& x);
19 #include "test_macros.h"
24 std::istringstream
is("5");
25 std::complex<double> c
;
27 assert(c
== std::complex<double>(5, 0));
31 std::istringstream
is(" 5 ");
32 std::complex<double> c
;
34 assert(c
== std::complex<double>(5, 0));
38 std::istringstream
is(" 5, ");
39 std::complex<double> c
;
41 assert(c
== std::complex<double>(5, 0));
45 std::istringstream
is(" , 5, ");
46 std::complex<double> c
;
48 assert(c
== std::complex<double>(0, 0));
52 std::istringstream
is("5.5 ");
53 std::complex<double> c
;
55 assert(c
== std::complex<double>(5.5, 0));
59 std::istringstream
is(" ( 5.5 ) ");
60 std::complex<double> c
;
62 assert(c
== std::complex<double>(5.5, 0));
66 std::istringstream
is(" 5.5)");
67 std::complex<double> c
;
69 assert(c
== std::complex<double>(5.5, 0));
73 std::istringstream
is("(5.5 ");
74 std::complex<double> c
;
76 assert(c
== std::complex<double>(0, 0));
80 std::istringstream
is("(5.5,");
81 std::complex<double> c
;
83 assert(c
== std::complex<double>(0, 0));
87 std::istringstream
is("( -5.5 , -6.5 )");
88 std::complex<double> c
;
90 assert(c
== std::complex<double>(-5.5, -6.5));
94 std::istringstream
is("(-5.5,-6.5)");
95 std::complex<double> c
;
97 assert(c
== std::complex<double>(-5.5, -6.5));