diff options
Diffstat (limited to 'libcxx/test/std/input.output')
35 files changed, 148 insertions, 1712 deletions
diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp index e9df54f417f..799ec5eaeb5 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/bool.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - bool n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - bool n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp index 615765c7c6e..9f9872d9ef8 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/double.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp index 72fd7ed27a7..c2b937a89cf 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/float.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - float n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - float n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp index d099fa82c5f..702287be79e 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/int.pass.cpp @@ -16,7 +16,6 @@ #include <istream> #include <limits> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -77,44 +76,6 @@ int main(int, char**) assert(!is.eof()); assert( is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp index a517406b5a5..9f9118cbcdc 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp index 769e9a33847..bdd30190a5b 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_double.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - long double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - long double n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp index dff93d169aa..1612468f4d7 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/long_long.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp index f88be1b18ab..0893d8cdec2 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/pointer.pass.cpp @@ -19,7 +19,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -98,44 +97,6 @@ int main(int, char**) assert( is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - void* n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - void* n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp index 56ab5843a49..a0d96c3983f 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/short.pass.cpp @@ -16,7 +16,6 @@ #include <istream> #include <limits> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -77,44 +76,6 @@ int main(int, char**) assert(!is.eof()); assert( is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp index 79d3dcb8d18..578cfcf0cc4 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_int.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned int n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp index 10e2fab9b27..f1c150d7920 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp index 9a73e87204a..068d31ac8fb 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_long_long.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned long long n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp index c4d95f5c1e7..9906bbeac8d 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream.formatted.arithmetic/unsigned_short.pass.cpp @@ -15,7 +15,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,44 +75,6 @@ int main(int, char**) assert(!is.eof()); assert(!is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned short n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp index 15f26fcaaa3..cbb606cdcff 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/chart.pass.cpp @@ -13,7 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -84,80 +83,6 @@ int main(int, char**) assert(!is.fail()); assert(c == L'c'); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - wchar_t n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - wchar_t n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp index d5ae9098213..bd06de6a07b 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char.pass.cpp @@ -13,7 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -67,44 +66,6 @@ int main(int, char**) assert(!is.fail()); assert(c == 'c'); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - signed char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - signed char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp index 64ff48d2973..d5128339a71 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/signed_char_pointer.pass.cpp @@ -13,7 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -104,46 +103,6 @@ int main(int, char**) assert(std::string((char*)s) == ""); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - signed char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - signed char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp index bf244e1e8d3..9feb826906f 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/streambuf.pass.cpp @@ -11,13 +11,11 @@ // template <class charT, class traits = char_traits<charT> > // class basic_istream; -// basic_istream<charT,traits>& operator>>(basic_streambuf<charT,traits>* sb); +// basic_istream<charT,traits>& operator<<(basic_streambuf<charT,traits>* sb); #include <istream> #include <cassert> -#include "test_macros.h" - template <class CharT> class testbuf : public std::basic_streambuf<CharT> @@ -67,104 +65,6 @@ int main(int, char**) assert(sb2.str() == "testing..."); assert(is.gcount() == 10); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - testbuf<char> sb2; - is.exceptions(std::istream::eofbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); - testbuf<wchar_t> sb2; - is.exceptions(std::istream::eofbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - testbuf<char> sb2; - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - testbuf<wchar_t> sb2; - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> &sb2; - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> static_cast<testbuf<char>*>(0); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::istream::failbit); - bool threw = false; - try { - is >> static_cast<testbuf<wchar_t>*>(0); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp index 8d86d11c1ae..3eceaaeb63f 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char.pass.cpp @@ -13,7 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -67,44 +66,6 @@ int main(int, char**) assert(!is.fail()); assert(c == 'c'); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned char n = 0; - is >> n; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp index 7e4bf41c966..14b2993148d 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/unsigned_char_pointer.pass.cpp @@ -13,7 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -104,46 +103,6 @@ int main(int, char**) assert(std::string((char*)s) == ""); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - unsigned char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - unsigned char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp index 117a0ba83e3..f0a9e0710fb 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.formatted/istream_extractors/wchar_t_pointer.pass.cpp @@ -13,7 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -115,84 +114,6 @@ int main(int, char**) assert(std::string(s) == ""); } #endif -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<wchar_t> sb; - std::wistream is(&sb); - is.exceptions(std::ios_base::failbit); - - bool threw = false; - try { - wchar_t s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - char s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } - { - testbuf<wchar_t> sb; - std::wistream is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - wchar_t s[20]; - is.width(10); - is >> s; - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(is.fail()); - assert(is.eof()); - assert(threw); - } -#endif // TEST_HAS_NO_EXCEPTIONS - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp index 0eaf58b69b3..6786ebf4ca0 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.manip/ws.pass.cpp @@ -14,7 +14,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -76,42 +75,6 @@ int main(int, char**) assert(is.eof()); assert(is.fail()); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - std::ws(is); - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - } - { - testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - std::ws(is); - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert(!is.fail()); - assert( is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp index 788e215c8ee..40a04174133 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get.pass.cpp @@ -12,7 +12,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -97,50 +96,6 @@ int main(int, char**) assert(c == L'c'); assert(is.gcount() == 1); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb("rrrrrrrrr"); - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - is.get(); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } - { - testbuf<wchar_t> sb(L"rrrrrrrrr"); - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - is.get(); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp index 7b5e56dec43..ae31c9be06d 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_chart.pass.cpp @@ -12,7 +12,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -100,52 +99,6 @@ int main(int, char**) assert(c == L'c'); assert(is.gcount() == 1); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb("rrrrrrrrr"); - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - char c; - is.get(c); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } - { - testbuf<wchar_t> sb(L"rrrrrrrrr"); - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::eofbit); - - bool threw = false; - try { - while (true) { - wchar_t c; - is.get(c); - if (is.eof()) - break; - } - } catch (std::ios_base::failure const&) { - threw = true; - } - - assert(!is.bad()); - assert( is.fail()); - assert( is.eof()); - assert(threw); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp index 2a88b726139..149392cae3f 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size.pass.cpp @@ -84,6 +84,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf<char> sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.get(s, 5); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf<wchar_t> sb(L" \n \n "); std::wistream is(&sb); @@ -120,77 +140,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::string(s) == " "); - assert(is.gcount() == 1); - } - { testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::wstring(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string<char>(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { - is.get(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string<wchar_t>(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp index df8ccc8127a..e7c96d6a266 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_pointer_size_chart.pass.cpp @@ -84,6 +84,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf<char> sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.get(s, 5, '*'); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf<wchar_t> sb(L" * * "); std::wistream is(&sb); @@ -120,77 +140,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string<char>(s) == " "); - assert(is.gcount() == 1); - } - { testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.get(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string<wchar_t>(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { - is.get(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string<char>(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::failbit); - bool threw = false; - try { - is.get(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string<wchar_t>(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp index f34873c04e0..dda59d7ff50 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf.pass.cpp @@ -13,8 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" - template <class CharT> class testbuf : public std::basic_streambuf<CharT> @@ -86,73 +84,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 3); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - testbuf<char> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); - testbuf<wchar_t> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - testbuf<char> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - testbuf<wchar_t> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp index adef49b8f43..a1e46c2336c 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/get_streambuf_chart.pass.cpp @@ -13,7 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> class testbuf @@ -86,73 +85,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 3); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - testbuf<char> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); - testbuf<wchar_t> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - testbuf<char> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - testbuf<wchar_t> sb2; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.get(sb2, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp index de54bf429a8..9c91053ebdb 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size.pass.cpp @@ -76,6 +76,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf<char> sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.getline(s, 5); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf<wchar_t> sb(L" \n \n "); std::wistream is(&sb); @@ -104,77 +124,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string<char>(s) == " "); - assert(is.gcount() == 1); - } - { testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string<wchar_t>(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string<char>(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string<wchar_t>(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp index de191672591..bee1976e95e 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/getline_pointer_size_chart.pass.cpp @@ -76,6 +76,26 @@ int main(int, char**) assert(std::string(s) == ""); assert(is.gcount() == 0); } +#ifndef TEST_HAS_NO_EXCEPTIONS + { + testbuf<char> sb(" "); + std::istream is(&sb); + char s[5] = "test"; + is.exceptions(std::istream::eofbit | std::istream::badbit); + try + { + is.getline(s, 5, '*'); + assert(false); + } + catch (std::ios_base::failure&) + { + } + assert( is.eof()); + assert( is.fail()); + assert(std::string(s) == " "); + assert(is.gcount() == 1); + } +#endif { testbuf<wchar_t> sb(L" * * "); std::wistream is(&sb); @@ -104,77 +124,22 @@ int main(int, char**) } #ifndef TEST_HAS_NO_EXCEPTIONS { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string<char>(s) == " "); - assert(is.gcount() == 1); - } - { testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); + std::wistream is(&sb); wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { + is.exceptions(std::wistream::eofbit | std::wistream::badbit); + try + { is.getline(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; + assert(false); } - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - assert(threw); - assert(std::basic_string<wchar_t>(s) == L" "); - assert(is.gcount() == 1); - } - - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - char s[5] = "test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5, '*'); - } catch (std::ios_base::failure&) { - threw = true; + catch (std::ios_base::failure&) + { } - assert(!is.bad()); assert( is.eof()); assert( is.fail()); - assert(threw); - assert(std::basic_string<char>(s) == ""); - assert(is.gcount() == 0); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - wchar_t s[5] = L"test"; - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.getline(s, 5, L'*'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - assert(threw); - assert(std::basic_string<wchar_t>(s) == L""); - assert(is.gcount() == 0); + assert(std::wstring(s) == L" "); + assert(is.gcount() == 1); } #endif diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp index 62831626371..7f6348b01a4 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/ignore.pass.cpp @@ -14,8 +14,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" - template <class CharT> struct testbuf : public std::basic_streambuf<CharT> @@ -74,38 +72,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 6); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb(" "); - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.ignore(5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf<wchar_t> sb(L" "); - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.ignore(5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp index 2d099322ad8..17943463e90 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/peek.pass.cpp @@ -12,7 +12,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -66,38 +65,6 @@ int main(int, char**) assert(!is.fail()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.peek(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::eofbit); - bool threw = false; - try { - is.peek(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert(!is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp index 588c0a6def5..4ca3a8c0edb 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/putback.pass.cpp @@ -13,8 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" - template <class CharT> struct testbuf : public std::basic_streambuf<CharT> @@ -87,38 +85,6 @@ int main(int, char**) assert(is.bad()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.putback('x'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.putback(L'x'); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp index 0ae8bcfe161..9296e0bfb2e 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/read.pass.cpp @@ -12,7 +12,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" template <class CharT> struct testbuf @@ -78,40 +77,6 @@ int main(int, char**) assert( is.fail()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::eofbit); - char s[10]; - bool threw = false; - try { - is.read(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::eofbit); - wchar_t s[10]; - bool threw = false; - try { - is.read(s, 5); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert(!is.bad()); - assert( is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp index ff22e9876f5..43ddd811080 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/sync.pass.cpp @@ -13,8 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" - int sync_called = 0; template <class CharT> @@ -48,41 +46,6 @@ protected: } }; -#ifndef TEST_HAS_NO_EXCEPTIONS -struct testbuf_exception { }; - -template <class CharT> -struct throwing_testbuf - : public std::basic_streambuf<CharT> -{ - typedef std::basic_string<CharT> string_type; - typedef std::basic_streambuf<CharT> base; -private: - string_type str_; -public: - - throwing_testbuf() {} - throwing_testbuf(const string_type& str) - : str_(str) - { - base::setg(const_cast<CharT*>(str_.data()), - const_cast<CharT*>(str_.data()), - const_cast<CharT*>(str_.data()) + str_.size()); - } - - CharT* eback() const {return base::eback();} - CharT* gptr() const {return base::gptr();} - CharT* egptr() const {return base::egptr();} - -protected: - virtual int sync() - { - throw testbuf_exception(); - return 5; - } -}; -#endif // TEST_HAS_NO_EXCEPTIONS - int main(int, char**) { { @@ -97,36 +60,6 @@ int main(int, char**) assert(is.sync() == 0); assert(sync_called == 2); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - throwing_testbuf<char> sb(" 123456789"); - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.sync(); - } catch (testbuf_exception const&) { - threw = true; - } - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - throwing_testbuf<wchar_t> sb(L" 123456789"); - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.sync(); - } catch (testbuf_exception const&) { - threw = true; - } - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } diff --git a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp index b48ff86fbaa..ca00af4e3c3 100644 --- a/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp +++ b/libcxx/test/std/input.output/iostream.format/input.streams/istream.unformatted/unget.pass.cpp @@ -13,8 +13,6 @@ #include <istream> #include <cassert> -#include "test_macros.h" - template <class CharT> struct testbuf : public std::basic_streambuf<CharT> @@ -79,38 +77,6 @@ int main(int, char**) assert(is.bad()); assert(is.gcount() == 0); } -#ifndef TEST_HAS_NO_EXCEPTIONS - { - testbuf<char> sb; - std::basic_istream<char> is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.unget(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } - { - testbuf<wchar_t> sb; - std::basic_istream<wchar_t> is(&sb); - is.exceptions(std::ios_base::badbit); - bool threw = false; - try { - is.unget(); - } catch (std::ios_base::failure&) { - threw = true; - } - assert(threw); - assert( is.bad()); - assert(!is.eof()); - assert( is.fail()); - } -#endif - return 0; + return 0; } |