#include <istream>
#include <sstream>
#include <ext/pod_char_traits.h>
#include <testsuite_hooks.h>
void test01()
{
using namespace std;
using __gnu_test::pod_type;
typedef basic_string<pod_type> string_type;
typedef basic_stringbuf<pod_type> stringbuf_type;
typedef basic_istream<pod_type> istream_type;
bool test __attribute__((unused)) = true;
const string_type str01;
stringbuf_type strbuf01;
stringbuf_type strbuf02(str01);
istream_type istr01(&strbuf01);
istream_type istr02(&strbuf02);
try
{
istream_type::sentry sentry01(istr01);
}
catch (std::bad_cast& obj)
{
}
catch (...)
{
VERIFY( false );
}
try
{
istream_type::sentry sentry02(istr01, true);
}
catch (std::bad_cast& obj)
{
}
catch (...)
{
VERIFY( false );
}
const std::locale loc(std::locale::classic(), new std::ctype<pod_type>);
istr01.imbue(loc);
try
{
istream_type::sentry sentry01(istr01);
VERIFY( bool(sentry01) == false );
}
catch (...)
{
VERIFY( false );
}
try
{
istream_type::sentry sentry02(istr01, true);
VERIFY( bool(sentry02) == false );
}
catch (...)
{
VERIFY( false );
}
try
{
istream_type::sentry sentry03(istr02);
}
catch (std::bad_cast& obj)
{
}
catch (...)
{
VERIFY( false );
}
try
{
istream_type::sentry sentry04(istr02, true);
}
catch (std::bad_cast& obj)
{
}
catch (...)
{
VERIFY( false );
}
istr02.imbue(loc);
try
{
istr02.clear();
istream_type::sentry sentry03(istr02);
VERIFY( bool(sentry03) == false );
}
catch (...)
{
VERIFY( false );
}
try
{
istr02.clear();
istream_type::sentry sentry04(istr02, true);
VERIFY( bool(sentry04) == true );
}
catch (...)
{
VERIFY( false );
}
}
#if !__GXX_WEAK__
template
std::basic_string<__gnu_test::pod_type>::size_type
std::basic_string<__gnu_test::pod_type>::_Rep::_S_max_size;
template
__gnu_test::pod_type
std::basic_string<__gnu_test::pod_type>::_Rep::_S_terminal;
#endif
int main()
{
test01();
return 0;
}