#include <istream>
#include <sstream>
#include <testsuite_hooks.h>
void test01()
{
typedef std::ios::traits_type ctraits_type;
bool test __attribute__((unused)) = true;
const std::string str_01;
const std::string str_02("art taylor kickin it on DAKAR");
std::string strtmp;
std::stringbuf isbuf_00(std::ios_base::in);
std::stringbuf isbuf_01(std::ios_base::in | std::ios_base::out);
std::stringbuf isbuf_02(str_01, std::ios_base::in);
std::stringbuf isbuf_03(str_01, std::ios_base::in | std::ios_base::out);
std::stringbuf isbuf_04(str_02, std::ios_base::in);
std::stringbuf isbuf_05(str_02, std::ios_base::in | std::ios_base::out);
std::istream is_00(NULL);
std::istream is_01(&isbuf_01);
std::istream is_02(&isbuf_02);
std::istream is_03(&isbuf_03);
std::istream is_04(&isbuf_04);
std::istream is_05(&isbuf_05);
std::ios_base::iostate state1, state2, statefail, stateeof;
statefail = std::ios_base::failbit;
stateeof = std::ios_base::eofbit;
state1 = is_00.rdstate();
is_00 >> &isbuf_00;
state2 = is_00.rdstate();
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
VERIFY( isbuf_00.str() == str_01 );
is_00.clear(std::ios_base::goodbit);
state1 = is_00.rdstate();
is_00 >> &isbuf_01;
state2 = is_00.rdstate();
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
VERIFY( isbuf_01.str() == str_01 );
is_00.clear(std::ios_base::goodbit);
state1 = is_00.rdstate();
is_00 >> &isbuf_04;
state2 = is_00.rdstate();
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
VERIFY( isbuf_04.str() == str_02 );
is_00.clear(std::ios_base::goodbit);
state1 = is_00.rdstate();
is_00 >> &isbuf_05;
state2 = is_00.rdstate();
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
VERIFY( isbuf_05.str() == str_02 );
state1 = is_02.rdstate();
is_02 >> &isbuf_04;
state2 = is_02.rdstate();
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
VERIFY( isbuf_04.str() == str_02 ); VERIFY( isbuf_04.sgetc() == 'a' );
is_02.clear(std::ios_base::goodbit);
state1 = is_02.rdstate();
is_02 >> &isbuf_05;
state2 = is_02.rdstate();
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
VERIFY( isbuf_05.str() == str_02 ); VERIFY( isbuf_05.sgetc() == 'a' );
state1 = is_04.rdstate();
is_04 >> &isbuf_02;
state2 = is_04.rdstate();
VERIFY( state1 != state2 );
VERIFY( static_cast<bool>(state2 & statefail) );
VERIFY( isbuf_02.str() == str_01 ); VERIFY( isbuf_02.sgetc() == ctraits_type::eof() );
VERIFY( is_04.peek() == ctraits_type::eof() );
is_04.clear(std::ios_base::goodbit);
state1 = is_04.rdstate();
is_04 >> &isbuf_03;
state2 = is_04.rdstate();
VERIFY( state1 == state2 );
VERIFY( !static_cast<bool>(state2 & statefail) );
VERIFY( state2 != stateeof );
strtmp = isbuf_03.str();
VERIFY( strtmp == str_02 ); VERIFY( isbuf_03.sgetc() == 'a' );
VERIFY( is_04.peek() == ctraits_type::eof() );
}
int main()
{
test01();
return 0;
}