2#if !defined (STLPORT) || !defined (_STLP_USE_NO_IOSTREAMS)
15# if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
23# if (!defined(STLPORT) && (defined (__GNUC__) && (__GNUC__ > 3))) || \
24 (defined (STLPORT) && !defined (_STLP_NO_CUSTOM_IO) && !defined (_STLP_NO_MEMBER_TEMPLATES) && \
25 !((defined (_STLP_MSVC) && (_STLP_MSVC < 1300)) || \
26 (defined (__GNUC__) && (__GNUC__ < 3)) || \
27 (defined (__SUNPRO_CC)) || \
28 (defined (__DMC__) && defined (_DLL))))
29# define DO_CUSTOM_FACET_TEST
51# if defined (STLPORT) && (defined (_STLP_NO_WCHAR_T) || !defined (_STLP_USE_EXCEPTIONS))
55# if !defined (STLPORT) || !defined (_STLP_WIN32)
58# if defined (CHECK_BIG_FILE)
61# if !defined (DO_CUSTOM_FACET_TEST)
82# if !defined (STLPORT) || !defined (_STLP_WIN32)
86# if defined (CHECK_BIG_FILE)
100 f << 1 <<
'\n' << 2.0 <<
'\n' <<
"abcd\n" <<
"ghk lm\n" <<
"abcd ef";
132#if defined (STLPORT) && !defined (_STLP_USE_WIN32_IO)
146 char buf[16] = { 0,
'1',
'2',
'3' };
161 f << 1 <<
'\n' << 2.0 <<
'\n' <<
"abcd\n" <<
"ghk lm\n" <<
"abcd ef";
164 f.seekg( 0, ios_base::beg );
200 f.seekg( 0, ios_base::beg );
214 ofstream of(
"test_file.txt", ios_base::out | ios_base::binary | ios_base::trunc);
217 for (
int i = 0;
i < 50; ++
i) {
226 ifstream is(
"test_file.txt", ios_base::in | ios_base::binary);
232 for (
int i = 0;
i < 50; ++
i) {
245 ifstream is(
"test_file.txt", ios_base::in | ios_base::binary);
249 for (
int i = 0;
i < 50; ++
i) {
254 is.seekg(
p, ios_base::beg );
261 ifstream is(
"test_file.txt", ios_base::in | ios_base::binary);
265 for (
int i = 0;
i < 50; ++
i) {
268 is.seekg( 8, ios_base::cur );
310 long expected_pos = 0;
318 long expected_pos = 9;
320 ofstream o(
"test_file.txt", ios_base::app | ios_base::out );
326 long expected_pos = 0;
328 long expected_pos = 9;
337 ofstream o(
"test_file.txt", ios_base::app | ios_base::out );
346 fstream ss(
"test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc );
348 ss <<
"1234567\n89\n";
349 ss.seekg( 0, ios_base::beg );
376 fstream s(
"test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc );
383 char b1[] = {
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x' };
384 fstream s(
"test_file.txt", ios_base::in | ios_base::out | ios_base::binary );
387 int chars_read = (
int)
s.rdbuf()->sgetn(
b1,
sizeof(
b1) );
393 char b2[10] = {
'y',
'y',
'y',
'y',
'y',
'y',
'y',
'y',
'y',
'y' };
402 fstream s(
"test_file.txt", ios_base::in | ios_base::out | ios_base::trunc );
409 char b1[] = {
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x' };
410 fstream s(
"test_file.txt", ios_base::in | ios_base::out );
413 int chars_read = (
int)
s.rdbuf()->sgetn(
b1,
sizeof(
b1) );
424 char b2[10] = {
'y',
'y',
'y',
'y',
'y',
'y',
'y',
'y',
'y',
'y' };
429 pos =
s.rdbuf()->pubseekoff(0, ios_base::cur);
434#if !defined (STLPORT) || \
435 (!defined (_STLP_NO_WCHAR_T) && defined (_STLP_USE_EXCEPTIONS))
451 wfstream s(
"test_file.txt", ios_base::in | ios_base::out | ios_base::trunc );
456 s <<
L"1234567890\n";
460 wchar_t b1[] = {
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x',
L'x' };
461 wfstream s(
"test_file.txt", ios_base::in | ios_base::out );
466 int chars_read = (
int)
s.rdbuf()->sgetn(
b1,
sizeof(
b1) /
sizeof(
wchar_t) );
474 off =
s.rdbuf()->pubseekoff(-off, ios_base::cur);
476 off =
s.rdbuf()->pubseekoff(0, ios_base::beg);
479 wchar_t b2[10] = {
L'y',
L'y',
L'y',
L'y',
L'y',
L'y',
L'y',
L'y',
L'y',
L'y' };
484 pos =
s.rdbuf()->pubseekoff(0, ios_base::cur);
493 fstream ss(
"test_file.txt", ios_base::in | ios_base::out | ios_base::binary | ios_base::trunc );
495 ss <<
"1234567\n89\n";
496 ss.seekg( 0, ios_base::beg );
499 ss.get( *os.rdbuf(),
'\n' );
511 ofstream ofstr(
"test_file.txt", ios_base::binary);
515 ofstr <<
"01234567890123456789";
520 ifstream in(
"test_file.txt", ios_base::binary);
543# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
546 ifstream in(
"test_file.txt", ios_base::binary);
575 const char*
file_name =
"win32_file_format.tmp";
576 const size_t nb_lines = 2049;
581 for (
size_t i = 0;
i < nb_lines - 1; ++
i) {
590 string line, last_line;
591 size_t nb_read_lines = 0;
602#if defined (DO_CUSTOM_FACET_TEST)
612#if !defined (STLPORT)
620 typedef char intern_type;
621 typedef char extern_type;
622 typedef my_state state_type;
624 explicit codecvt(
size_t __refs = 0) :
locale::facet(__refs) {}
626 const intern_type* __from,
628 const intern_type*& __from_next,
631 extern_type*& __to_next)
const
632 { __from_next = __from; __to_next = __to;
return noconv; }
635 const extern_type* __from,
637 const extern_type*& __from_next,
640 intern_type*& __to_next)
const
641 { __from_next = __from; __to_next = __to;
return noconv; }
643 result unshift(state_type&,
646 extern_type*& __to_next)
const
647 { __to_next = __to;
return noconv; }
652 bool always_noconv()
const throw()
655 int length(
const state_type&,
656 const extern_type* __from,
657 const extern_type* __end,
659 {
return (
int)
min(
static_cast<size_t>(__end - __from),
__max); }
661 int max_length()
const throw()
670# if defined (__BORLANDC__) && (__BORLANDC__ < 0x590)
679#if defined (DO_CUSTOM_FACET_TEST)
680 const char* fileName =
"test_file.txt";
683 ofstream ofstr(fileName, ios_base::binary);
684 ofstr <<
"0123456789";
692 my_ifstream ifstr(fileName);
695# if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
705# if !defined (STLPORT) || !defined (_STLP_NO_WCHAR_T)
722# if defined (CHECK_BIG_FILE)
723void FstreamTest::big_file()
741 for (
int i = 0;
i < 20; ++
i) {
748 nb *= CHECK_BIG_FILE;
753 if (
index % 1024 == 0) {
756 if (file_pos.
size() > 1) {
770 pitEnd(file_pos.
end());
771 for (; pit != pitEnd; ++pit) {
772 in.seekg((*pit).first);
775 size_t lastStarPos =
line.rfind(
'*');
800# if (defined (STLPORT) && defined (_STLP_USE_WIN32_IO)) || \
801 (!defined (STLPORT) && (defined (WIN32) || defined (_WIN32)))
802 const char* nullStreamName =
"NUL";
804 const char* nullStreamName =
"/dev/null";
807 ofstream nullStream(nullStreamName);
812 ofstream nullStream(nullStreamName, ios_base::ate);
817 ofstream nullStream(nullStreamName, ios_base::trunc);
822 ofstream nullStream(nullStreamName, ios_base::app);
827 ifstream nullStream(nullStreamName);
832 ifstream nullStream(nullStreamName, ios_base::ate);
837 fstream nullStream(nullStreamName);
842 fstream nullStream(nullStreamName, ios_base::in | ios_base::out | ios_base::ate);
847 fstream nullStream(nullStreamName, ios_base::in | ios_base::out | ios_base::trunc);
875 fstream f(
"test.txt", ios_base::in | ios_base::out | ios_base::trunc );
878 for (
int i = 0;
i < 0x200; ++
i ) {
892 f.seekg( 0, ios_base::beg );
904# if !defined (STLPORT) || !defined (_STLP_WIN32)
907# if (defined(_LARGEFILE_SOURCE) || defined(_LARGEFILE64_SOURCE)) && !defined(_STLP_USE_DEFAULT_FILE_OFFSET)
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setw(int __n)
_STLP_PRIV _Setfill_Manip< _CharT > _STLP_CALL setfill(_CharT __c)
_STLP_PRIV _Ios_Setf_Manip _STLP_CALL setiosflags(ios_base::fmtflags __flag)
basic_ostream< char, char_traits< char > > ostream
basic_ofstream< char, char_traits< char > > ofstream
basic_ostringstream< char, char_traits< char >, allocator< char > > ostringstream
basic_ifstream< char, char_traits< char > > ifstream
bool has_facet(const locale &__loc) _STLP_NOTHROW
pair< _T1, _T2 > _STLP_CALL make_pair(_T1 __x, _T2 __y)
CPPUNIT_TEST(win32_file_format)
CPPUNIT_TEST(streambuf_output)
CPPUNIT_TEST_SUITE(FstreamTest)
CPPUNIT_TEST(null_stream)
CPPUNIT_TEST(custom_facet)
_Traits::pos_type pos_type
_Traits::pos_type pos_type
std::string const & str() const
static const locale &_STLP_CALL classic()
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
#define CPPUNIT_ASSERT(X)
result_buffer_count char *const _In_ int const _In_ bool const _In_ unsigned const _In_ STRFLT const _In_ bool const _Inout_ __crt_cached_ptd_host &ptd throw()
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLenum GLenum GLenum input
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
static CRYPT_DATA_BLOB b2[]
static CRYPT_DATA_BLOB b1[]
void push_back(const _Tp &__x=_STLP_DEFAULT_CONSTRUCTED(_Tp))
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out