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 //===----------------------------------------------------------------------===//
8 
9 // XFAIL: libcpp-has-no-stdin
10 
11 // <iostream>
12 
13 // istream cin;
14 
15 // RUN: %{build}
16 // RUN: %{exec} echo "123" \| %t.exe > %t.out
17 // RUN: grep -e 'The number is 123!' %t.out
18 
19 #include <iostream>
20 #include <cassert>
21 
22 #include "test_macros.h"
23 
24 int main(int, char**)
25 {
26     int i;
27     std::cin >> i;
28     std::cout << "The number is " << i << "!";
29 
30 #ifdef _LIBCPP_HAS_NO_STDOUT
31     assert(std::cin.tie() == NULL);
32 #else
33     assert(std::cin.tie() == &std::cout);
34 #endif
35 
36   return 0;
37 }
38