[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.ops / stream_input.pass.cpp
blob5c78fe98dd13d0bc078d07b666b113eeb317ae83
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 // template<class T, class charT, class traits>
12 // basic_istream<charT, traits>&
13 // operator>>(basic_istream<charT, traits>& is, complex<T>& x);
15 #include <complex>
16 #include <sstream>
17 #include <cassert>
19 #include "test_macros.h"
21 int main(int, char**)
24 std::istringstream is("5");
25 std::complex<double> c;
26 is >> c;
27 assert(c == std::complex<double>(5, 0));
28 assert(is.eof());
31 std::istringstream is(" 5 ");
32 std::complex<double> c;
33 is >> c;
34 assert(c == std::complex<double>(5, 0));
35 assert(is.good());
38 std::istringstream is(" 5, ");
39 std::complex<double> c;
40 is >> c;
41 assert(c == std::complex<double>(5, 0));
42 assert(is.good());
45 std::istringstream is(" , 5, ");
46 std::complex<double> c;
47 is >> c;
48 assert(c == std::complex<double>(0, 0));
49 assert(is.fail());
52 std::istringstream is("5.5 ");
53 std::complex<double> c;
54 is >> c;
55 assert(c == std::complex<double>(5.5, 0));
56 assert(is.good());
59 std::istringstream is(" ( 5.5 ) ");
60 std::complex<double> c;
61 is >> c;
62 assert(c == std::complex<double>(5.5, 0));
63 assert(is.good());
66 std::istringstream is(" 5.5)");
67 std::complex<double> c;
68 is >> c;
69 assert(c == std::complex<double>(5.5, 0));
70 assert(is.good());
73 std::istringstream is("(5.5 ");
74 std::complex<double> c;
75 is >> c;
76 assert(c == std::complex<double>(0, 0));
77 assert(is.fail());
80 std::istringstream is("(5.5,");
81 std::complex<double> c;
82 is >> c;
83 assert(c == std::complex<double>(0, 0));
84 assert(is.fail());
87 std::istringstream is("( -5.5 , -6.5 )");
88 std::complex<double> c;
89 is >> c;
90 assert(c == std::complex<double>(-5.5, -6.5));
91 assert(!is.eof());
94 std::istringstream is("(-5.5,-6.5)");
95 std::complex<double> c;
96 is >> c;
97 assert(c == std::complex<double>(-5.5, -6.5));
98 assert(!is.eof());
101 return 0;