13171-2.cc: Tweak for a few small problems (fix timings, use VERIFY..)

2003-11-29  Paolo Carlini  <pcarlini@suse.de>

	* testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc:
	Tweak for a few small problems (fix timings, use VERIFY..)

From-SVN: r74034
This commit is contained in:
Paolo Carlini 2003-11-29 17:42:16 +00:00 committed by Paolo Carlini
parent 26b0ad130a
commit 2d25605a54
2 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2003-11-29 Paolo Carlini <pcarlini@suse.de>
* testsuite/27_io/basic_filebuf/imbue/char/13171-2.cc:
Tweak for a few small problems (fix timings, use VERIFY..)
2003-11-28 Paolo Carlini <pcarlini@suse.de>
* testsuite/27_io/basic_filebuf/imbue/char/13171-3.cc: Remove.

View File

@ -20,7 +20,6 @@
#include <fstream>
#include <locale>
#include <cassert>
#include <sys/types.h>
#include <sys/stat.h>
@ -33,6 +32,9 @@ void test01()
bool test __attribute__((unused)) = true;
using namespace std;
locale loc_fr(__gnu_test::try_named_locale("fr_FR"));
locale loc_en(__gnu_test::try_named_locale("en_US"));
const char* name = "tmp_fifo_13171-2";
unlink(name);
mkfifo(name, S_IRWXU);
@ -43,21 +45,25 @@ void test01()
filebuf fb;
fb.open(name, ios_base::out);
fb.sputc('S');
fb.pubsync();
sleep(2);
fb.close();
return;
exit(0);
}
filebuf fb;
fb.pubimbue(__gnu_test::try_named_locale("fr_FR"));
fb.pubimbue(loc_fr);
fb.open(name, ios_base::in);
assert(fb.is_open());
fb.pubimbue(__gnu_test::try_named_locale("en_US"));
sleep(1);
VERIFY( fb.is_open() );
fb.pubimbue(loc_en);
filebuf::int_type c = fb.sgetc();
assert(c == 'S');
fb.close();
VERIFY( c == 'S' );
}
int main()
{
test01();
return 0;
}