// RUN: %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe
// RUN: %{exec} %t.exe 0
-// RUN: %{exec} ! %t.exe 1
+// RUN: %{exec} bash -c '! %t.exe 1'
#include <cassert>
#include <cstdlib>
--- /dev/null
+program=${1}
+expected_stderr=${2}
+${program} 2>stderr.log >stdout.log
+[ "${expected_stderr}" == "$(cat stderr.log)" ]
--- /dev/null
+program=${1}
+expected_stdout=${2}
+${program} 2>stderr.log >stdout.log
+[ "${expected_stdout}" == "$(cat stdout.log)" ]
// istream cerr;
+// FILE_DEPENDENCIES: ../check-stderr.sh
// RUN: %{build}
-// RUN: %{exec} %t.exe 2> %t.err
-// RUN: grep -e 'Hello World!' %t.err
+// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
#include <iostream>
#include <cassert>
#include "test_macros.h"
-int main(int, char**)
-{
-
- std::cerr << "Hello World!\n";
+int main(int, char**) {
+ std::cerr << "1234";
+ assert(std::cerr.flags() & std::ios_base::unitbuf);
#ifdef _LIBCPP_HAS_NO_STDOUT
assert(std::cerr.tie() == NULL);
#else
assert(std::cerr.tie() == &std::cout);
#endif
- assert(std::cerr.flags() & std::ios_base::unitbuf);
-
- return 0;
+ return 0;
}
// istream cin;
+// FILE_DEPENDENCIES: ../send-stdin.sh
// RUN: %{build}
-// RUN: %{exec} echo "123" \| %t.exe > %t.out
-// RUN: grep -e 'The number is 123!' %t.out
+// RUN: %{exec} bash send-stdin.sh "%t.exe" "1234"
#include <iostream>
#include <cassert>
-#include "test_macros.h"
-
-int main(int, char**)
-{
+int main(int, char**) {
int i;
std::cin >> i;
- std::cout << "The number is " << i << "!";
-
-#ifdef _LIBCPP_HAS_NO_STDOUT
- assert(std::cin.tie() == NULL);
-#else
- assert(std::cin.tie() == &std::cout);
-#endif
-
- return 0;
+ assert(i == 1234);
+ return 0;
}
// istream clog;
+// FILE_DEPENDENCIES: ../check-stderr.sh
// RUN: %{build}
-// RUN: %{exec} %t.exe 2> %t.err
-// RUN: grep -e 'Hello World!' %t.err
+// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
#include <iostream>
-#include "test_macros.h"
-
-int main(int, char**)
-{
- std::clog << "Hello World!\n";
-
+int main(int, char**) {
+ std::clog << "1234";
return 0;
}
// istream cout;
+// FILE_DEPENDENCIES: ../check-stdout.sh
// RUN: %{build}
-// RUN: %{exec} %t.exe > %t.out
-// RUN: grep -e 'Hello World!' %t.out
+// RUN: %{exec} bash check-stdout.sh "%t.exe" "1234"
#include <iostream>
-#include "test_macros.h"
-
-int main(int, char**)
-{
- std::cout << "Hello World!\n";
-
+int main(int, char**) {
+ std::cout << "1234";
return 0;
}
--- /dev/null
+program=${1}
+input=${2}
+echo -n ${input} | ${program}
// istream wcerr;
+// FILE_DEPENDENCIES: ../check-stderr.sh
// RUN: %{build}
-// RUN: %{exec} %t.exe 2> %t.err
-// RUN: grep -e 'Hello World!' %t.err
+// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
#include <iostream>
#include <cassert>
#include "test_macros.h"
-int main(int, char**)
-{
- std::wcerr << L"Hello World!\n";
+int main(int, char**) {
+ std::wcerr << L"1234";
+ assert(std::wcerr.flags() & std::ios_base::unitbuf);
#ifdef _LIBCPP_HAS_NO_STDOUT
assert(std::wcerr.tie() == NULL);
#else
assert(std::wcerr.tie() == &std::wcout);
#endif
- assert(std::wcerr.flags() & std::ios_base::unitbuf);
-
return 0;
}
// istream wcin;
+// FILE_DEPENDENCIES: ../send-stdin.sh
// RUN: %{build}
-// RUN: %{exec} echo "123" \| %t.exe > %t.out
-// RUN: grep -e 'The number is 123!' %t.out
+// RUN: %{exec} bash send-stdin.sh "%t.exe" "1234"
#include <iostream>
#include <cassert>
-#include "test_macros.h"
-
-int main(int, char**)
-{
+int main(int, char**) {
int i;
std::wcin >> i;
- std::wcout << L"The number is " << i << L"!";
-
-#ifdef _LIBCPP_HAS_NO_STDOUT
- assert(std::wcin.tie() == NULL);
-#else
- assert(std::wcin.tie() == &std::wcout);
-#endif
-
+ assert(i == 1234);
return 0;
}
// istream wclog;
+// FILE_DEPENDENCIES: ../check-stderr.sh
// RUN: %{build}
-// RUN: %{exec} %t.exe 2> %t.err
-// RUN: grep -e 'Hello World!' %t.err
+// RUN: %{exec} bash check-stderr.sh "%t.exe" "1234"
#include <iostream>
-#include "test_macros.h"
-
-int main(int, char**)
-{
- std::wclog << L"Hello World!\n";
-
+int main(int, char**) {
+ std::wclog << L"1234";
return 0;
}
// istream wcout;
+// FILE_DEPENDENCIES: ../check-stdout.sh
// RUN: %{build}
-// RUN: %{exec} %t.exe > %t.out
-// RUN: grep -e 'Hello World!' %t.out
+// RUN: %{exec} bash check-stdout.sh "%t.exe" "1234"
#include <iostream>
-#include "test_macros.h"
-
-int main(int, char**)
-{
- std::wcout << L"Hello World!\n";
-
+int main(int, char**) {
+ std::wcout << L"1234";
return 0;
}