Update contrib.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 #include <StifParser.h>
23 #include <Stiftestinterface.h>
36 #include <stl\char_traits.h>
41 #include "tiostreams.h"
43 #define STDCPP_OOM FALSE// TRUE for OOM testing
46 // ============================ MEMBER FUNCTIONS ===============================
48 // -----------------------------------------------------------------------------
49 // Ctiostreams::Delete
50 // Delete here all resources allocated and opened from test methods.
51 // Called from destructor.
52 // -----------------------------------------------------------------------------
54 void Ctiostreams::Delete()
59 // -----------------------------------------------------------------------------
60 // Ctiostreams::RunMethodL
61 // Run specified method. Contains also table of test mothods and their names.
62 // -----------------------------------------------------------------------------
64 TInt Ctiostreams::RunMethodL(
65 CStifItemParser& aItem )
68 static TStifFunctionInfo const KFunctions[] =
70 // Copy this line for every implemented function.
71 // First string is the function name used in TestScripter script file.
72 // Second is the actual implementation member function.
73 // Second is the actual implementation member function.
74 ENTRY( "iofstreamL", Ctiostreams::iofstreamL ),
75 ENTRY( "stringbufL", Ctiostreams::stringbufL ),
76 ENTRY( "stringstreamL", Ctiostreams::stringstreamL ),
77 ENTRY( "streambufL", Ctiostreams:: streambufL ),
78 ENTRY( "ostreamL", Ctiostreams:: ostreamL ),
79 ENTRY( "istreamL", Ctiostreams:: istreamL ),
80 ENTRY( "istringstreamL", Ctiostreams:: istringstreamL ),
81 ENTRY( "ostringstreamL", Ctiostreams:: ostringstreamL ),
82 ENTRY( "ostreamiterators", Ctiostreams::ostreamiterators ),
83 ENTRY( "fstreamL", Ctiostreams::fstreamL),
84 ENTRY( "istrstreamL", Ctiostreams::istrstreamL),
85 ENTRY( "strstreamL", Ctiostreams::strstreamL),
86 ENTRY( "ostrstreamL", Ctiostreams::ostrstreamL),
87 ENTRY( "istreamiterators", Ctiostreams::istreamiterators ),
88 ENTRY( "istreambufiterators", Ctiostreams::istreambufiterators ),
89 ENTRY( "strstreambufL", Ctiostreams::strstreambufL ),
90 ENTRY( "freezeL", Ctiostreams::freezeL ),
91 ENTRY( "fposL", Ctiostreams::fposL ),
92 ENTRY( "filebufL", Ctiostreams::filebufL ),
93 ENTRY( "basicstring", Ctiostreams::basicstring ),
94 ENTRY( "basicfilebufL", Ctiostreams::basicfilebufL ),
95 ENTRY( "basicistreamL", Ctiostreams::basicistreamL ),
96 ENTRY( "wfstreamL", Ctiostreams::wfstreamL ),
97 ENTRY( "wifstreamL", Ctiostreams::wifstreamL ),
98 ENTRY( "wistreamL", Ctiostreams::wistreamL ),
99 ENTRY( "wofstreamL", Ctiostreams::wofstreamL ),
100 ENTRY( "wistringstreamL", Ctiostreams::wistringstreamL ),
101 ENTRY( "wostringstreamL", Ctiostreams::wostringstreamL ),
102 ENTRY( "wstreambufL", Ctiostreams::wstreambufL ),
103 ENTRY( "wostreamL", Ctiostreams::wostreamL ),
104 ENTRY( "wstringbufL", Ctiostreams::wstringbufL ),
110 const TInt count = sizeof( KFunctions ) /
111 sizeof( TStifFunctionInfo );
113 return RunInternalL( KFunctions, count, aItem );
118 // -----------------------------------------------------------------------------
119 // Ctiostreams:: ofstream,ifstream
120 // Example test method function.
121 // (other items were commented in a header).
122 // -----------------------------------------------------------------------------
126 TInt Ctiostreams::iofstreamL( CStifItemParser& aItem )
136 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
143 myfile.open ("c:\\TestFramework\\docs\\example.txt");
144 if(!myfile.is_open())
147 myfile << "Writing this to a file.";
160 myfile1.open("c:\\TestFramework\\docs\\example.txt" );
162 fbuf=myfile1.rdbuf();
165 // get file size using buffer's members
166 size=fbuf->pubseekoff (0,ios::end,ios::in);
167 fbuf->pubseekpos (0,ios::in);
169 // allocate memory to contain file data
170 buffer=new char[size];
173 fbuf->sgetn (buffer,size);
176 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
180 if(buffer != "Writing this to a file.");
188 if(!myfile1.is_open())
191 if(myfile1.is_open())
195 ios_base::Init(); // 0 - 218 FUNCTION Init() iostream.cpp
196 filebuf* _Stl_create_filebuf(FILE* f, ios_base::openmode mode ); // 0 - 225 FUNCTION _Stl_create_filebuf() iostream.cpp
197 ios_base::sync_with_stdio();//0 - 445 FUNCTION ios_base::sync_with_stdio()
231 // -----------------------------------------------------------------------------
232 // Ctiostreams:: stringbuf
233 // Example test method function.
234 // (other items were commented in a header).
235 // -----------------------------------------------------------------------------
238 TInt Ctiostreams::stringbufL(CStifItemParser& aItem )
246 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
251 sb.sputn("Sample string",13);
256 if(sb.in_avail()!=13)
260 char ch = sb.sgetc();
269 if(mystr.compare("Sample string") != 0)
273 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
304 // -----------------------------------------------------------------------------
305 // Ctiostreams:: stringstream
306 // Example test method function.
307 // (other items were commented in a header).
308 // -----------------------------------------------------------------------------
312 TInt Ctiostreams::stringstreamL(CStifItemParser& aItem )
322 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
324 stringstream ss (stringstream::in | stringstream::out);
325 stringstream teststring;
328 teststring<<"stringstream testcase";
330 teststr = teststring.str();
332 if(!teststr.compare("stringstream testcase"))
337 ss << "120 42 377 6 5 2000";
339 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
341 for (int n=0; n<6; n++)
409 // -----------------------------------------------------------------------------
410 // Ctiostreams:: streambuf
411 // Example test method function.
412 // (other items were commented in a header).
413 // -----------------------------------------------------------------------------
416 TInt Ctiostreams::streambufL(CStifItemParser& aItem )
418 // locale loc ("en_GB.UTF-8");
432 char sentence[]= "Sample sentence";
435 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
438 ofstream ostr ("c:\\TestFramework\\docs\\streambuf.txt");
442 if(!cout.rdbuf( )->getloc( ).name( ).c_str( )) //failing
455 pbuf->sputn (sentence,sizeof(sentence)-1);
458 ostr.open("c:\\TestFramework\\docs\\streambuf.txt");
464 long size1 = pbuf->pubseekoff(0,ios_base::end);
472 long size2 = pbuf->pubseekoff(0,ios_base::end);
476 ifstream istr("c:\\TestFramework\\docs\\streambuf.txt");
479 streamsize i = istr.rdbuf()->sgetn(&a[0], 3);
481 // Display the size and contents of the buffer passed to sgetn.
486 int k = pbuf->snextc();
490 while (pbuf->sgetc()!=EOF)
495 ch[i] = pbuf->sbumpc();
510 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
543 // -----------------------------------------------------------------------------
544 // Ctiostreams:: ostream
545 // Example test method function.
546 // (other items were commented in a header).
547 // -----------------------------------------------------------------------------
550 TInt Ctiostreams::ostreamL(CStifItemParser& aItem )
561 char input[17] = "ostream testcase";
563 fb.open ("c:\\TestFramework\\docs\\ostream.txt",ios::out);
566 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
570 os.write(input,size);
571 streamoff i = os.tellp();
576 streamoff j = os.tellp();
582 streamoff k = os.tellp();
590 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
622 // -----------------------------------------------------------------------------
623 // Ctiostreams:: istream
624 // Example test method function.
625 // (other items were commented in a header).
626 // -----------------------------------------------------------------------------
628 TInt Ctiostreams::istreamL(CStifItemParser& aItem )
640 fb.open ("c:\\TestFramework\\docs\\istream.txt",ios::in);
643 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
650 // get length of file:
651 is.seekg (0, ios::end);
653 is.seekg (0, ios::beg);
678 char pk1 = is.peek();
686 char pk2 = is.peek();
693 is.getline(getl,8,'\0');
695 if(getl == "Khaheen")
712 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
736 // -----------------------------------------------------------------------------
737 // Ctiostreams:: istringstream
738 // Example test method function.
739 // (other items were commented in a header).
740 // -----------------------------------------------------------------------------
743 TInt Ctiostreams::istringstreamL(CStifItemParser& aItem )
749 string strvalues = "125 320 512 750 333";
752 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
755 istringstream iss (strvalues,istringstream::in);
757 if(iss.str() != "125 320 512 750 333")
761 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
829 // -----------------------------------------------------------------------------
830 // Ctiostreams:: ostringstream,
831 // Example test method function.
832 // (other items were commented in a header).
833 // -----------------------------------------------------------------------------
836 TInt Ctiostreams::ostringstreamL(CStifItemParser& aItem )
843 basic_string<char> i( "test" );
846 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
850 ss.rdbuf( )->str( i );
851 if(ss.str( ).compare("test") != 0)
855 if(ss.str( ) .compare("zest")!=0)
858 ss.rdbuf( )->str( "be" );
859 if(ss.str( ).compare("be")!=0)
863 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
896 TInt Ctiostreams::ostreamiterators(CStifItemParser& aItem )
901 //____________________
903 int arr[4] = { 3,4,7,8 };
905 deque<int> d(arr+0, arr+4);
907 // stream the whole vector and a sum to cout
910 copy(d.begin(),(d.end()-1),ostream_iterator<int,char>(cout,""));
913 if( *(d.end()-1) == 8)
922 // -----------------------------------------------------------------------------
923 // Ctiostreams:: fstream
924 // Example test method function.
925 // (other items were commented in a header).
926 // -----------------------------------------------------------------------------
930 TInt Ctiostreams::fstreamL(CStifItemParser& aItem )
938 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
940 fstream filestr ("c:\\TestFramework\\docs\\fstream.txt", fstream::in | fstream::out);
942 if(!filestr.is_open())
946 if(filestr.is_open())
956 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
979 // -----------------------------------------------------------------------------
980 // Ctiostreams:: istrstream
981 // Example test method function.
982 // (other items were commented in a header).
983 // -----------------------------------------------------------------------------
985 TInt Ctiostreams::istrstreamL(CStifItemParser& aItem )
993 char* p = "This is first string";
994 char* q = "This is second string";
996 const char* s ="const char";
1000 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1002 istrstream first(p);
1003 istrstream second(q);
1004 istrstream third(r);
1008 istrstream five(p,n);
1009 istrstream six(s,n);
1010 /* if(first.str() == "This is first string")
1011 if(second.str()!= " This is second string")
1012 if(third.str() == "")
1022 if(first.str() != "This is first string")
1023 if(second.str()== " This is second string")
1024 if(third.str() != "")
1028 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1053 TInt Ctiostreams::strstreamL(CStifItemParser& aItem )
1062 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1066 ios_base::openmode mode;
1067 // strstream ss3(s, n, mode);
1071 if(ss1.rdbuf( )->pcount( ) != 0)
1074 string str1= ss1.str();
1075 if(str1.compare("")!=0)
1078 ss2 << "strstream testcase";
1080 if( ss2.rdbuf( )->pcount( ) != sizeof("strstream testcase\0")-1)
1083 string str = ss2.str();
1085 if(str.compare("strstream testcase")!= 0)
1098 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1123 TInt Ctiostreams::ostrstreamL(CStifItemParser& aItem )
1132 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1136 ios_base::openmode mode;
1137 // ostrstream oss3( s, n, mode);
1138 ostrstream oss1 ,oss2;
1142 if(oss1.rdbuf( )->pcount( ) != 0)
1145 oss2 << "ostrstream testcase";
1149 if(str.compare("ostrstream testcase") !=0)
1155 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1189 TInt Ctiostreams::istreamiterators(CStifItemParser& aItem )
1193 // Typedefs for convenience.
1199 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1202 typedef std::vector<int, std::allocator<int> > Vector;
1204 typedef std::istream_iterator<Vector::value_type,char, std::char_traits<char>, ptrdiff_t> is_iter;
1207 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1238 TInt Ctiostreams::istreambufiterators(CStifItemParser& aItem )
1243 // create a temporary filename
1250 const char *fname = tmpnam (0);
1255 // open the file is_iter.out for reading and writing
1256 std::ofstream out (fname, std::ios::out | std::ios::in |
1259 // output the example sentence into the file
1261 // seek to the beginning of the file
1265 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1267 // construct an istreambuf_iterator pointing to
1268 // the ofstream object underlying streambuffer
1269 std::istreambuf_iterator<char, std::char_traits<char> >iter (out.rdbuf ());
1271 // construct an end of stream iterator
1272 const std::istreambuf_iterator<char,std::char_traits<char> > end;
1274 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1276 std::cout << std::endl;
1278 // output the content of the file
1279 while (!iter.equal (end)) {
1281 // use both operator++ and operator*
1282 std::cout << *iter++;
1285 std::cout << std::endl;
1287 // remove temporary file
1315 TInt Ctiostreams::strstreambufL(CStifItemParser& aItem )
1328 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1334 unsigned char* uget;
1335 unsigned char* uput;
1337 const signed char* csget;
1339 const unsigned char* cucget;
1342 typedef void* (*__alloc_fn)(size_t);
1343 typedef void (*__free_fn)(void*);
1350 strstreambuf buf1(get, n,put);
1354 strstreambuf buf2(uget,n,uput);
1357 strstreambuf buf3(cget,n);
1359 strstreambuf buf4(csget,n);
1361 strstreambuf buf5(cucget,n);
1364 // strstreambuf buf6( alloc_f, free_f);
1365 strstreambuf buf7(n);
1369 int i = buf.sputn("strstreambuf testcase", sizeof("strstreambuf testcase")-1);
1371 if((buf.pcount())!= i)
1375 //if(buf.str() != "strstreambuf testcase") //fails
1379 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1413 TInt Ctiostreams::freezeL(CStifItemParser& aItem )
1429 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1432 x.rdbuf()->freeze();
1434 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1439 // Stream is bad now, wrote on frozen stream
1445 // Unfreeze stream, but it is still bad
1446 x.rdbuf()->freeze(false);
1462 // Clean up. Failure to unfreeze stream will cause a
1464 x.rdbuf()->freeze(false);
1497 TInt Ctiostreams::fposL(CStifItemParser& aItem )
1505 ifstream file( "c:\\TestFramework\\docs\\fpos_state.txt" );
1508 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1510 fpos<mbstate_t> f = file.tellg( );
1512 while ( !file.eof( ) )
1518 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1554 // -----------------------------------------------------------------------------
1555 // Cstdcpp_filebuf::filebufL
1556 // Example test method function.
1557 // (other items were commented in a header).
1558 // -----------------------------------------------------------------------------
1560 TInt Ctiostreams::filebufL( CStifItemParser& aItem )
1571 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1576 fb->open ("c:\\TestFramework\\docs\\filebuf.txt",ios::in);
1588 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1620 TInt Ctiostreams::basicstring( CStifItemParser& aItem )
1628 const char *cstr1a = "Hello Out There.";
1631 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1633 basic_string<char> str1a(cstr1a ,5);
1635 if(str1a.compare("Hello")!=0)
1638 str1a.append("Out There");
1639 if(!str1a.compare("Hello Out There"))
1643 string str2a ( "How Do You Do?" );
1644 basic_string <char> str2b ( str2a , 7 , 7 );
1646 if(str2b.compare("You Do?")!=0)
1651 basic_string <char> str3a ( 5, '9' );
1652 if(str3a.compare("99999")!=0)
1657 basic_string <char> str4a;
1659 basic_string <char> str4c ( str4b.get_allocator( ) );
1660 if (!str4c.empty ())
1665 string str5a ( "Hello World");
1666 basic_string <char>::iterator strp_Iter, str1_Iter, str2_Iter;
1670 strp_Iter = str5a.begin();
1671 if(*strp_Iter != 'H' )
1677 basic_string <char>::reference refStr2 = str5a.at ( 3 );
1683 if(str5a.size()!=11)
1685 if(str5a.length()!=11)
1687 if(str5a.capacity()!=11)
1693 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1718 // -----------------------------------------------------------------------------
1719 // Ctwiostreams::basic_filebuf
1720 // Example test method function.
1722 // -----------------------------------------------------------------------------
1725 TInt Ctiostreams::basicfilebufL( CStifItemParser& aItem )
1733 char* wszHello = "Hello World";
1737 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1740 basic_filebuf<char> wOutFile;
1743 // Open a file, wcHello.txt, then write to it, then dump the
1744 // file's contents in hex
1745 wOutFile.open("c:\\TestFramework\\docs\\basicfilebuf.txt",ios_base::out | ios_base::trunc | ios_base::binary);
1746 if(!wOutFile.is_open())
1749 wOutFile.sputn(wszHello, 11);
1751 if(wOutFile.is_open())
1754 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1784 // -----------------------------------------------------------------------------
1785 // Ctwiostreams::basic_istream
1786 // Example test method function.
1788 // -----------------------------------------------------------------------------
1791 TInt Ctiostreams::basicistreamL( CStifItemParser& aItem )
1800 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1804 typedef std::basic_istream<char, std::char_traits<char> > Input;
1805 typedef std::basic_ofstream<Input::char_type, Input::traits_type> Output;
1808 Input::char_type s [200];
1810 Output out ("c:\\TestFramework\\docs\\basicistream.txt", std::ios::in | std::ios::out | std::ios::trunc);
1812 Input in (out.rdbuf ());
1817 // output to the file
1818 out << "He lifted his head and pondered.\n"
1819 << f << std::endl << i << std::endl;
1821 // seek to the beginning of the file
1832 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1859 // -----------------------------------------------------------------------------
1860 // Ctwiostreams::wfstream
1861 // Example test method function.
1863 // -----------------------------------------------------------------------------
1865 TInt Ctiostreams::wfstreamL( CStifItemParser& aItem )
1875 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1881 file.open("c:\\TestFramework\\docs\\wfstream.txt");
1891 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1918 // -----------------------------------------------------------------------------
1919 // Ctwiostreams::wifstream
1920 // Example test method function.
1922 // -----------------------------------------------------------------------------
1924 TInt Ctiostreams::wifstreamL( CStifItemParser& aItem )
1933 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
1939 file.open("c:\\TestFramework\\docs\\wifstream.txt");
1951 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
1977 // -----------------------------------------------------------------------------
1978 // Ctwiostreams::wfilebuf,wistream
1979 // Example test method function.
1981 // -----------------------------------------------------------------------------
1983 TInt Ctiostreams::wistreamL( CStifItemParser& aItem )
1996 fb.open ("c:\\TestFramework\\docs\\wistream.txt",ios::in);
1999 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
2006 //if( char(is.get())!= 'S')
2009 //if(sizeof(fb)!=140)
2015 // get length of file:
2016 is.seekg (0, ios::end);
2017 length = is.tellg();
2018 is.seekg (0, ios::beg);
2027 wchar_t ch = is.get();
2030 if(is.gcount() != 1)
2043 wchar_t pk1 = is.peek();
2051 wchar_t pk2 = is.peek();
2058 is.getline(getl,16,'\0');
2060 if(getl == L"Kample sentence")
2070 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
2101 // -----------------------------------------------------------------------------
2102 // Ctwiostreams::wofstream
2103 // Example test method function.
2105 // -----------------------------------------------------------------------------
2108 TInt Ctiostreams::wofstreamL( CStifItemParser& aItem )
2116 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
2121 outfile.open("c:\\TestFramework\\docs\\wostream.txt");
2122 outfile.write(L"This is an ostreamfile",22);
2125 if(!outfile.is_open())
2131 if(outfile.is_open())
2134 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
2162 // -----------------------------------------------------------------------------
2163 // Ctwiostreams::wistringstream
2164 // Example test method function.
2166 // -----------------------------------------------------------------------------
2168 TInt Ctiostreams::wistringstreamL( CStifItemParser& aItem )
2179 strvalues = L"1 2 3 4 5";
2182 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
2184 wistringstream iss(strvalues,wistringstream::in);
2186 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
2203 if(iss.str()!=L"1 2 3 4 5")
2244 // -----------------------------------------------------------------------------
2245 // Ctwiostreams::wostringstream,wstring
2246 // Example test method function.
2248 // -----------------------------------------------------------------------------
2250 TInt Ctiostreams::wostringstreamL( CStifItemParser& aItem )
2256 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
2263 oss << L"wostringstream testcase";
2267 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
2269 /*if(mystr.compare(L"wostringstream testcase")==0)
2273 if(mystr.compare(L"wostringstream testcase")!=0)
2294 // -----------------------------------------------------------------------------
2295 // Ctwiostreams::wstreambuf,wofstreams
2296 // Example test method function.
2298 // -----------------------------------------------------------------------------
2301 TInt Ctiostreams::wstreambufL( CStifItemParser& aItem )
2305 //locale loc ("en_GB.UTF-8");
2319 wchar_t sentence[]= L"Sample sentence"; cout<<"";
2321 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
2324 wofstream ostr ("c:\\TestFramework\\docs\\wstreambuf.txt");
2328 // if(cout.rdbuf( )->getloc( ).name( ).c_str( ) != "C") //failing
2333 pbuf = ostr.rdbuf();
2341 pbuf->sputn (sentence,sizeof(sentence)-1);
2344 ostr.open("c:\\TestFramework\\docs\\wstreambuf.txt");
2350 long size1 = pbuf->pubseekoff(0,ios_base::end);
2358 long size2 = pbuf->pubseekoff(0,ios_base::end);
2362 wifstream istr("c:\\TestFramework\\docs\\wstreambuf.txt");
2363 pbuf = istr.rdbuf();
2365 streamsize i = istr.rdbuf()->sgetn(&a[0], 3);
2366 //a[i] = istr.widen('\0');
2368 // Display the size and contents of the buffer passed to sgetn.
2373 int k = pbuf->snextc();
2377 while (pbuf->sgetc()!=EOF)
2381 ch[i] = pbuf->sbumpc();
2397 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
2425 // -----------------------------------------------------------------------------
2426 // Ctwiostreams::wostream
2427 // Example test method function.
2429 // -----------------------------------------------------------------------------
2432 TInt Ctiostreams::wostreamL( CStifItemParser& aItem )
2443 wchar_t input[18] = L"wostream testcase";
2444 streamsize size = 5;
2445 fb.open ("c:\\TestFramework\\docs\\wostream.txt",ios::out); cout<<"";
2447 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
2451 os.write(input,size);
2452 streamoff i = os.tellp();
2457 streamoff j = os.tellp();
2463 streamoff k = os.tellp();
2471 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
2500 // -----------------------------------------------------------------------------
2501 // Ctwiostreams::wstringbuf
2502 // Example test method function.
2504 // -----------------------------------------------------------------------------
2507 TInt Ctiostreams::wstringbufL( CStifItemParser& aItem )
2514 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
2520 sb.sputn (L"Sample string",13);
2523 /*if(mystr.compare(L"Sample string") == 0)
2529 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
2531 if(mystr.compare(L"Sample string") != 0)