os/ossrv/stdcpp/tsrc/Stdcpp_test/bcdrivers/tlocale/src/tlocaleblocks.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 // INCLUDE FILES
    22 #include <e32svr.h>
    23 #include <StifParser.h>
    24 #include <Stiftestinterface.h>
    25 #include<locale>
    26 #include<stl/_locale.h>
    27 #include<iostream>
    28 #include<string>
    29 #include "tlocale.h"
    30 #define STDCPP_OOM FALSE
    31 using namespace std;
    32 // ============================ MEMBER FUNCTIONS ===============================
    33 
    34 // -----------------------------------------------------------------------------
    35 // Ctlocale::Delete
    36 // Delete here all resources allocated and opened from test methods. 
    37 // Called from destructor. 
    38 // -----------------------------------------------------------------------------
    39 //
    40 void Ctlocale::Delete() 
    41     {
    42 
    43     }
    44 
    45 // -----------------------------------------------------------------------------
    46 // Ctlocale::RunMethodL
    47 // Run specified method. Contains also table of test mothods and their names.
    48 // -----------------------------------------------------------------------------
    49 //
    50 TInt Ctlocale::RunMethodL( 
    51     CStifItemParser& aItem ) 
    52     {
    53 
    54     static TStifFunctionInfo const KFunctions[] =
    55         {  
    56         // Copy this line for every implemented function.
    57         // First string is the function name used in TestScripter script file.
    58         // Second is the actual implementation member function. 
    59  ENTRY( "hasfacet", Ctlocale::hasfacet ),
    60  ENTRY( "usefacet", Ctlocale::usefacet ),
    61  ENTRY( "numget", Ctlocale::numget ),
    62  ENTRY( "numput", Ctlocale::numput ),
    63  ENTRY( "num_punct", Ctlocale::num_punct ),  
    64  ENTRY( "numpunctbyname", Ctlocale::numpunctbyname ),
    65  ENTRY( "moneyget", Ctlocale::moneyget ),
    66  ENTRY( "moneyput", Ctlocale::moneyput ),
    67  ENTRY( "money_punct", Ctlocale::money_punct ),  
    68  ENTRY( "moneypunctbyname", Ctlocale::moneypunctbyname ),
    69  ENTRY( "timeget", Ctlocale::timeget ),
    70  ENTRY( "timeput", Ctlocale::timeput ),
    71  ENTRY( "messagesL", Ctlocale::messagesL ),
    72  ENTRY( "messagesbyname", Ctlocale::messagesbyname ),
    73  ENTRY( "collateL", Ctlocale::collateL ),
    74  ENTRY( "collatebyname", Ctlocale::collatebyname ),
    75  ENTRY( "codecvt1", Ctlocale::codecvt1 ),
    76  ENTRY( "codecvt2", Ctlocale::codecvt2 ),
    77  ENTRY( "codecvtbyname1", Ctlocale::codecvtbyname1 ),
    78  ENTRY( "codecvtbyname2", Ctlocale::codecvtbyname2 ),
    79  ENTRY( "catalog", Ctlocale::catalog ),
    80  ENTRY( "c_type", Ctlocale::c_type ),
    81 
    82         };
    83 
    84     const TInt count = sizeof( KFunctions ) / 
    85                         sizeof( TStifFunctionInfo );
    86 
    87     return RunInternalL( KFunctions, count, aItem );
    88 
    89     }
    90 
    91 
    92 // -----------------------------------------------------------------------------
    93 // Ctlocale::has_facet
    94 // has_facet test method function.
    95 //  
    96 // -----------------------------------------------------------------------------
    97 //
    98 
    99 
   100 TInt Ctlocale::hasfacet( CStifItemParser& aItem )
   101     {
   102     int failures=0;
   103     try
   104     {
   105     	
   106     
   107  bool result = true;
   108   bool result_w = true;
   109  // __UHEAP_MARK;
   110  
   111    cout<<"";  
   112  
   113  #if  STDCPP_OOM
   114 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   115   #endif 
   116 // char* p = "c";
   117 //  const char* _Loc_ctype_default(p) ;
   118  
   119   locale loc("en_GB.UTF-8") ;
   120  result = has_facet <ctype<char> > ( loc );
   121   result_w = has_facet <ctype<wchar_t> > ( loc );
   122  #if  STDCPP_OOM
   123 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   124   #endif 
   125 
   126 //__UHEAP_MARKEND;
   127 /*
   128  if(result)
   129  return KErrNone;
   130  else
   131  return KErrGeneral;
   132  */
   133  if(!result)
   134  failures++;
   135  
   136   if(!result_w)
   137  failures++;
   138  
   139     }
   140 
   141 
   142  catch(bad_alloc&)
   143    {
   144    	//do nothing
   145     }
   146    catch(...)
   147    {
   148    	failures++;
   149    	
   150    }
   151    
   152 		  if(failures  )
   153 		  return KErrGeneral;
   154 		  return KErrNone;
   155     }
   156 
   157 
   158 // -----------------------------------------------------------------------------
   159 // Ctlocale::use_facet
   160 // use_facet test method function.
   161 //  
   162 // -----------------------------------------------------------------------------
   163 //
   164 
   165 
   166 TInt Ctlocale::usefacet( CStifItemParser& aItem )
   167     {
   168     int failures=0;
   169 //__UHEAP_MARK;
   170 try
   171 {
   172 	
   173 
   174  locale   loc ("en_GB.UTF-8");
   175  cout<<"";
   176  #if  STDCPP_OOM
   177 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   178   #endif 
   179  bool result = use_facet<ctype<char> > ( loc ).is(ctype_base::alpha, 'b');
   180   bool result_w = use_facet<ctype<wchar_t> > ( loc ).is(ctype_base::alpha, L'b');
   181  #if  STDCPP_OOM
   182 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   183   #endif 
   184  
   185 // __UHEAP_MARKEND;
   186 /* if (result)
   187  return KErrNone;
   188  else
   189  return KErrGeneral;
   190 
   191 */
   192 
   193 if(!result)
   194  failures++;
   195 
   196 if(!result_w)
   197  failures++;
   198  
   199  }
   200 
   201  catch(bad_alloc&)
   202    {
   203    	//do nothing
   204     }
   205    catch(...)
   206    {
   207    	failures++;
   208    	
   209    }
   210    
   211 		  if(failures  )
   212 		  return KErrGeneral;
   213 		  return KErrNone;
   214     }
   215 
   216 // -----------------------------------------------------------------------------
   217 // Ctlocale::num_get
   218 // num_get test method function.
   219 //  
   220 // -----------------------------------------------------------------------------
   221 //
   222 
   223 
   224 TInt Ctlocale::numget( CStifItemParser& aItem )
   225     {
   226     int failures=0;
   227     
   228     try
   229     {
   230     	
   231     
   232  typedef istreambuf_iterator<char,char_traits<char> >
   233  iter_type;
   234 
   235 
   236  
   237  locale loc;
   238  iter_type end;
   239  cout<<"";
   240 #if  STDCPP_OOM
   241 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   242   #endif 
   243   const num_get<char,iter_type>& tg = use_facet<num_get<char,iter_type> >(loc);
   244     
   245  	#if  STDCPP_OOM
   246 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   247   #endif 
   248  //return KErrNone;
   249 	
   250 	}
   251 
   252 
   253  catch(bad_alloc&)
   254    {
   255    	//do nothing
   256     }
   257    catch(...)
   258    {
   259    	failures++;
   260    	
   261    }
   262    
   263 		  if(failures  )
   264 		  return KErrGeneral;
   265 		  return KErrNone;
   266     }
   267 // -----------------------------------------------------------------------------
   268 // Ctlocale::num_put
   269 // num_put test method function.
   270 //  
   271 // -----------------------------------------------------------------------------
   272 //
   273 TInt Ctlocale::numput( CStifItemParser& aItem )
   274     {
   275     int failures=0;
   276     try
   277     {
   278     	
   279     
   280  typedef ostreambuf_iterator<char,char_traits<char> >
   281  iter_type;
   282 
   283  locale loc;
   284       
   285 
   286  // Construct a ostreambuf_iterator on cout
   287  iter_type begin(cout);
   288 
   289  // Get a num_put facet reference
   290  cout<<"";
   291  #if  STDCPP_OOM
   292 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   293   #endif 
   294  const num_put<char,iter_type>& np = use_facet<num_put<char,iter_type> >(loc);
   295   #if  STDCPP_OOM
   296 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   297   #endif     
   298   
   299 //return KErrNone;
   300 
   301  }
   302  
   303  
   304 
   305  catch(bad_alloc&)
   306    {
   307    	//do nothing
   308     }
   309    catch(...)
   310    {
   311    	failures++;
   312    	
   313    }
   314    
   315 		  if(failures  )
   316 		  return KErrGeneral;
   317 		  return KErrNone;
   318     }
   319 // -----------------------------------------------------------------------------
   320 // Ctlocale::num_punct
   321 // num_punct test method function.
   322 //  
   323 // -----------------------------------------------------------------------------
   324 // 
   325 TInt Ctlocale::num_punct( CStifItemParser& aItem )
   326  {
   327  int failures=0;
   328  try
   329  {
   330  	
   331  
   332  locale loc;
   333 cout<<"";
   334 #if  STDCPP_OOM
   335 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   336   #endif 
   337  const numpunct <char> &npunct = use_facet <numpunct <char> >( loc);
   338   const numpunct <wchar_t> &npunct_w = use_facet <numpunct <wchar_t> >( loc);
   339    // const numpunct <unsigned> &n1punct = use_facet <numpunct <unsigned> >( loc);
   340 #if  STDCPP_OOM
   341 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   342   #endif 
   343 /*   
   344  if(npunct.truename() ==  "true")
   345  if(npunct.falsename()=="false")  
   346  if(npunct.decimal_point() =='.')
   347  if(npunct.thousands_sep() ==',')
   348    
   349     
   350   
   351  return KErrNone;
   352  else
   353  return KErrGeneral;*/
   354   if(npunct.truename() !=  "true")
   355   failures++;
   356  if(npunct.falsename()!="false")  
   357  failures++;
   358  if(npunct.decimal_point() !='.')
   359  failures++;
   360  if(npunct.thousands_sep() !=',')
   361  failures++;
   362  
   363  
   364   if(npunct_w.truename() !=  L"true")
   365   failures++;
   366  if(npunct_w.falsename()!=L"false")  
   367  failures++;
   368  if(npunct_w.decimal_point() != L'.')
   369  failures++;
   370  if(npunct_w.thousands_sep() !=L',')
   371  failures++;
   372 
   373  }
   374 
   375 
   376  catch(bad_alloc&)
   377    {
   378    	//do nothing
   379     }
   380    catch(...)
   381    {
   382    	failures++;
   383    	
   384    }
   385    
   386 		  if(failures  )
   387 		  return KErrGeneral;
   388 		  return KErrNone;
   389     }
   390 // -----------------------------------------------------------------------------
   391 // Ctlocale::numpunct_byname
   392 // numpunct_byname test method function.
   393 //  
   394 // -----------------------------------------------------------------------------
   395 //
   396 TInt Ctlocale::numpunctbyname( CStifItemParser& aItem )
   397     {
   398     int failures=0;
   399     
   400     try
   401     {
   402     	
   403     
   404  locale loc;
   405 cout<<"";
   406 #if  STDCPP_OOM
   407 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   408   #endif 
   409  const numpunct_byname <char> &npunct = use_facet <numpunct_byname <char> >( loc);
   410   const numpunct_byname <wchar_t> &npunct_w = use_facet <numpunct_byname <wchar_t> >( loc);
   411    #if  STDCPP_OOM
   412 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   413   #endif 
   414     
   415  /*if(npunct.truename() ==  "true")
   416  if(npunct.falsename()=="false") 
   417  if(npunct.decimal_point( ) =='.')
   418  if(npunct.thousands_sep( ) ==',')
   419    
   420  
   421   
   422 return KErrNone;
   423 else
   424 return KErrGeneral;*/
   425 
   426 if(npunct.truename() !=  "true")
   427 failures++;
   428  if(npunct.falsename()!="false") 
   429  failures++;
   430  if(npunct.decimal_point( ) !='.')
   431  failures++;
   432  if(npunct.thousands_sep( ) !=',')
   433  failures++;
   434  
   435  
   436  
   437  if(npunct_w.truename() !=  L"true")
   438 failures++;
   439  if(npunct_w.falsename()!= L"false") 
   440  failures++;
   441  if(npunct_w.decimal_point( ) != L'.')
   442  failures++;
   443  if(npunct_w.thousands_sep( ) != L',')
   444  failures++;
   445    
   446  }
   447 
   448  catch(bad_alloc&)
   449    {
   450    	//do nothing
   451     }
   452    catch(...)
   453    {
   454    	failures++;
   455    	
   456    }
   457    
   458 		  if(failures  )
   459 		  return KErrGeneral;
   460 		  return KErrNone;
   461     }
   462 
   463 // -----------------------------------------------------------------------------
   464 // Ctlocale::money_get
   465 // money_get test method function.
   466 //  
   467 // -----------------------------------------------------------------------------
   468 //
   469 
   470 TInt Ctlocale::moneyget( CStifItemParser& aItem )
   471     {
   472     int failures=0;
   473     
   474     try
   475     {
   476     	
   477     
   478  typedef istreambuf_iterator<char,char_traits<char> >
   479  iter_type;
   480 
   481  locale loc;
   482  string buffer("$100.02");
   483  string dest;
   484 // long double ldest;
   485 // ios_base::iostate state;
   486  iter_type end;
   487  cout<<"";
   488 #if  STDCPP_OOM
   489 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   490   #endif 
   491  // Get a money_get facet
   492  const money_get<char,iter_type>& mgf =  use_facet<money_get<char,iter_type> >(loc);
   493      
   494 #if  STDCPP_OOM
   495 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   496   #endif 
   497 	
   498 // return KErrNone;
   499 	
   500 	}
   501 
   502 
   503  catch(bad_alloc&)
   504    {
   505    	//do nothing
   506     }
   507    catch(...)
   508    {
   509    	failures++;
   510    	
   511    }
   512    
   513 		  if(failures  )
   514 		  return KErrGeneral;
   515 		  return KErrNone;
   516     }
   517 // -----------------------------------------------------------------------------
   518 // Ctlocale::money_put
   519 // money_put test method function.
   520 //  
   521 // -----------------------------------------------------------------------------
   522 //
   523 TInt Ctlocale::moneyput( CStifItemParser& aItem )
   524     {
   525     int failures=0;
   526     
   527     try
   528     {
   529     	
   530     
   531  typedef ostreambuf_iterator<char,char_traits<char> >
   532  iter_type;
   533 
   534  locale loc;
   535  string buffer("10002");
   536 // long double ldval = 10002;
   537 
   538   iter_type begin(cout);
   539   cout<<"";
   540 #if  STDCPP_OOM
   541 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   542   #endif 
   543   const money_put<char,iter_type>& mp =   use_facet<money_put<char,iter_type> >(loc);
   544 
   545     #if  STDCPP_OOM
   546 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   547   #endif  
   548 
   549   
   550 //return KErrNone;
   551 
   552  }
   553  
   554  
   555  catch(bad_alloc&)
   556    {
   557    	//do nothing
   558     }
   559    catch(...)
   560    {
   561    	failures++;
   562    	
   563    }
   564    
   565 		  if(failures  )
   566 		  return KErrGeneral;
   567 		  return KErrNone;
   568     }
   569 
   570 // -----------------------------------------------------------------------------
   571 // Ctlocale::moneypunct
   572 // moneypunct test method function.
   573 //  
   574 // -----------------------------------------------------------------------------
   575 //
   576 TInt Ctlocale::money_punct( CStifItemParser& aItem )
   577     {
   578      
   579      int failures=0;
   580      try
   581      {
   582      	
   583      
   584  
   585  locale loc;
   586  cout<<"";
   587 #if  STDCPP_OOM
   588 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   589   #endif 
   590   
   591   
   592   
   593   const moneypunct<char,false>& mp = use_facet<moneypunct<char,false> >(loc);
   594     const moneypunct<char,true>& mp_true = use_facet<moneypunct<char,true> >(loc);
   595 
   596   
   597    const moneypunct<wchar_t,false>& mp_w = use_facet<moneypunct<wchar_t,false> >(loc);
   598    
   599       const moneypunct<wchar_t,true>& mp_w_true = use_facet<moneypunct<wchar_t,true> >(loc);
   600    #if  STDCPP_OOM
   601 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   602   #endif    
   603  mp.curr_symbol();
   604  mp.negative_sign();
   605 mp.grouping();
   606 mp.curr_symbol();
   607 mp.frac_digits();
   608 mp.pos_format() ;
   609 mp.neg_format(); 
   610 
   611 
   612 mp_true.curr_symbol();
   613  mp_true.negative_sign();
   614 mp_true.grouping();
   615 mp_true.curr_symbol();
   616 mp_true.frac_digits();
   617 mp_true.pos_format() ;
   618 mp_true.neg_format(); 
   619 
   620  mp_w.curr_symbol();
   621  mp_w.negative_sign();
   622 mp_w.grouping();
   623 mp_w.curr_symbol();
   624 mp_w.frac_digits();
   625 mp_w.pos_format() ;
   626 mp_w.neg_format(); 
   627 
   628 
   629 mp_w_true.curr_symbol();
   630  mp_w_true.negative_sign();
   631 mp_w_true.grouping();
   632 mp_w_true.curr_symbol();
   633 mp_w_true.frac_digits();
   634 mp_w_true.pos_format() ;
   635 mp_w_true.neg_format(); 
   636 
   637 /* if(mp.decimal_point() == '.')
   638  if(mp.thousands_sep() == ',')
   639  if( mp.frac_digits() == 0)
   640  
   641 
   642     
   643   
   644 return KErrNone;
   645 else
   646 return KErrGeneral;*/
   647 
   648 if(mp.decimal_point() != '.')
   649 failures++;
   650  if(mp.thousands_sep() != ',')
   651  failures++;
   652  if( mp.frac_digits() != 0)
   653  failures++;
   654 
   655  
   656  if(mp_true.decimal_point() != '.')
   657 failures++;
   658  if(mp_true.thousands_sep() != ',')
   659  failures++;
   660  if( mp_true.frac_digits() != 0)
   661  failures++;
   662  
   663  
   664  
   665  
   666  if(mp_w.decimal_point() != L'.')
   667 failures++;
   668  if(mp_w.thousands_sep() != L',')
   669  failures++;
   670  if( mp_w.frac_digits() != 0)
   671  failures++;
   672  
   673  
   674  if(mp_w_true.decimal_point() != L'.')
   675 failures++;
   676  if(mp_w_true.thousands_sep() != L',')
   677  failures++;
   678  if( mp_w_true.frac_digits() != 0)
   679  failures++;
   680 
   681  }
   682  
   683  
   684  
   685  catch(bad_alloc&)
   686    {
   687    	//do nothing
   688     }
   689    catch(...)
   690    {
   691    	failures++;
   692    	
   693    }
   694    
   695 		  if(failures  )
   696 		  return KErrGeneral;
   697 		  return KErrNone;
   698     }
   699 
   700 // -----------------------------------------------------------------------------
   701 // Ctlocale::moneypunct_byname
   702 // moneypunct_byname test method function.
   703 //  
   704 // -----------------------------------------------------------------------------
   705 // 
   706  
   707 TInt Ctlocale::moneypunctbyname( CStifItemParser& aItem )
   708     {
   709     
   710     int failures=0;
   711     try
   712     {
   713     	
   714     
   715                  
   716  locale loc;
   717   
   718  cout<<"";
   719  #if  STDCPP_OOM
   720 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   721   #endif 
   722   const moneypunct_byname<char,false>& mp = 
   723      
   724  use_facet<moneypunct_byname<char,false> >(loc);
   725  
   726    const moneypunct_byname<char,true>& mp_true = 
   727      
   728  use_facet<moneypunct_byname<char,true> >(loc);
   729  
   730  
   731    const moneypunct_byname<wchar_t,false>& mp_w = 
   732      
   733  use_facet<moneypunct_byname<wchar_t,false> >(loc);
   734  
   735  
   736  
   737     const moneypunct_byname<wchar_t,true>& mp_w_true = 
   738      
   739  use_facet<moneypunct_byname<wchar_t,true> >(loc);
   740    
   741    
   742    #if  STDCPP_OOM
   743 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   744   #endif 
   745    
   746  mp.curr_symbol();
   747  mp.negative_sign();
   748  if(mp.decimal_point() != '.')
   749  failures++;
   750  if(mp.thousands_sep() != ',')
   751  failures++;
   752  if( mp.frac_digits() != 0)
   753  failures++;
   754  
   755  
   756  mp_true.curr_symbol();
   757  mp_true.negative_sign();
   758  if(mp_true.decimal_point() != '.')
   759  failures++;
   760  if(mp_true.thousands_sep() != ',')
   761  failures++;
   762  if( mp_true.frac_digits() != 0)
   763  failures++;
   764  
   765   
   766  mp_w.curr_symbol();
   767  mp_w.negative_sign();
   768  if(mp_w.decimal_point() != L'.')
   769  failures++;
   770  if(mp_w.thousands_sep() != L',')
   771  failures++;
   772  if( mp_w.frac_digits() != 0)
   773  failures++;
   774  
   775  
   776  mp_w_true.curr_symbol();
   777  mp_w_true.negative_sign();
   778  if(mp_w_true.decimal_point() != L'.')
   779  failures++;
   780  if(mp_w_true.thousands_sep() != L',')
   781  failures++;
   782  if( mp_w_true.frac_digits() != 0)
   783  failures++; 
   784   
   785 
   786  }
   787 
   788  catch(bad_alloc&)
   789    {
   790    	//do nothing
   791     }
   792    catch(...)
   793    {
   794    	failures++;
   795    	
   796    }
   797    
   798 		  if(failures  )
   799 		  return KErrGeneral;
   800 		  return KErrNone;
   801     }
   802 
   803 // -----------------------------------------------------------------------------
   804 // Ctlocale::time_get
   805 // time_get  test method function.
   806 //  
   807 // -----------------------------------------------------------------------------
   808 // 
   809 
   810 
   811 TInt Ctlocale::timeget( CStifItemParser& aItem )
   812     {
   813     int failures=0;
   814     
   815     try
   816     {
   817     	
   818     
   819   typedef std::istreambuf_iterator<char,
   820   std::char_traits<char> > Iter;
   821 //  static struct tm timeb;  
   822 //  std::ios_base::iostate state;
   823 cout<<"";
   824     #if  STDCPP_OOM
   825 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   826   #endif 
   827  const std::time_get<char, Iter> &tg =
   828  std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
   829  #if  STDCPP_OOM
   830 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   831   #endif 
   832  //return KErrNone;
   833 	
   834 	}
   835 	
   836 	
   837  catch(bad_alloc&)
   838    {
   839    	//do nothing
   840     }
   841    catch(...)
   842    {
   843    	failures++;
   844    	
   845    }
   846    
   847 		  if(failures  )
   848 		  return KErrGeneral;
   849 		  return KErrNone;
   850     }
   851 
   852 // -----------------------------------------------------------------------------
   853 // Ctlocale::time_put
   854 // time_put  test method function.
   855 //  
   856 // -----------------------------------------------------------------------------
   857 // 
   858 TInt Ctlocale::timeput( CStifItemParser& aItem )
   859     { 
   860     
   861     int failures=0; 
   862     try
   863     {
   864     	
   865    
   866 /*    std::tm t = std::tm ();
   867    
   868     t.tm_sec   = 56;    
   869     t.tm_min   = 34;    
   870     t.tm_hour  = 14;    
   871     t.tm_mday  = 29;   
   872     t.tm_mon   =  1;    
   873     t.tm_year  = 84;    
   874                        
   875     t.tm_yday  = 59;    
   876     t.tm_wday  =  3;   
   877     t.tm_isdst =  0;   
   878 
   879     const char* const fmt[] = {
   880       "%a", "%A", "%b", "%B", "%c", "%C", "%d", "%D",
   881       "%e", "%F", "%g", "%G", "%h", "%H", "%I", "%j",
   882       "%k", "%l", "%m", "%M", "%n", "%p", "%r", "%R",
   883       "%S", "%t", "%T", "%u", "%U", "%V", "%w", "%W", "%x",
   884       "%X", "%y", "%Y", "%z", "%Z", "%%", "%Ec", "%EC", "%Ex",
   885       "%EX", "%Ey", "%EY", "%Od", "%Oe", "%OH", "%OI", "%Om",
   886       "%OM", "%OS", "%Ou", "%OU", "%OV", "%Ow", "%OW", "%Oy"         
   887     };*/
   888     cout<<"";
   889 #if  STDCPP_OOM
   890 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   891   #endif 
   892      const std::time_put<char> &tput =
   893         std::use_facet<std::time_put<char> >(std::cout.getloc ());
   894 
   895 #if  STDCPP_OOM
   896 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   897   #endif 
   898   
   899 //return KErrNone;
   900 
   901  }
   902  
   903  
   904  catch(bad_alloc&)
   905    {
   906    	//do nothing
   907     }
   908    catch(...)
   909    {
   910    	failures++;
   911    	
   912    }
   913    
   914 		  if(failures  )
   915 		  return KErrGeneral;
   916 		  return KErrNone;
   917     }
   918  
   919 // -----------------------------------------------------------------------------
   920 // Ctlocale::messages
   921 // messages  test method function.
   922 //  
   923 // -----------------------------------------------------------------------------
   924 // 
   925  
   926 TInt Ctlocale::messagesL( CStifItemParser& aItem )
   927 {
   928 int failures=0;
   929 
   930 try
   931 {
   932 	
   933  
   934       locale loc;
   935       cout<<"";
   936 #if  STDCPP_OOM
   937 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
   938   #endif 
   939        const messages<char>& mess =use_facet<messages<char> >(loc);
   940 #if  STDCPP_OOM
   941 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
   942   #endif 
   943   // no support to .cat files
   944 
   945       /*  
   946       string def("Message Not Found");
   947       messages<char>::catalog cat =
   948               mess.open("./rwstdmessages.cat",loc);
   949       if (cat != -1)
   950        {
   951         string msg0 = mess.get(cat,1,1,def);
   952         string msg1 = mess.get(cat,1,2,def);
   953         string msg2 = mess.get(cat,1,6,def); // invalid msg #
   954         string msg3 = mess.get(cat,2,1,def);
   955 
   956         mess.close(cat);
   957         cout << msg0 << endl << msg1 << endl
   958               << msg2 << endl << msg3 << endl;
   959        }
   960       else
   961         cout << "Unable to open message catalog" << endl;*/
   962 
   963       //return KErrNone;
   964 	
   965 }
   966 
   967 
   968 
   969  catch(bad_alloc&)
   970    {
   971    	//do nothing
   972     }
   973    catch(...)
   974    {
   975    	failures++;
   976    	
   977    }
   978    
   979 		  if(failures  )
   980 		  return KErrGeneral;
   981 		  return KErrNone;
   982     }
   983 
   984 // -----------------------------------------------------------------------------
   985 // Ctlocale::messages_byname
   986 // messages_byname  test method function.
   987 //  
   988 // -----------------------------------------------------------------------------
   989 // 
   990 TInt Ctlocale::messagesbyname( CStifItemParser& aItem )
   991 {
   992 int failures=0;
   993 
   994 try
   995 {
   996 	
   997  
   998  locale loc;
   999  cout<<"";
  1000 #if  STDCPP_OOM
  1001 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1002   #endif 
  1003  const messages_byname<char>& mess =
  1004       
  1005         use_facet<messages_byname<char> >(loc);
  1006 #if  STDCPP_OOM
  1007 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1008   #endif 
  1009     
  1010 // no support to .cat files
  1011     /*    
  1012       string def("Message Not Found");
  1013       messages_byname<char>::catalog cat =
  1014               mess.open("./rwstdmessages.cat",loc);
  1015       if (cat != -1)
  1016        {
  1017         string msg0 = mess.get(cat,1,1,def);
  1018         string msg1 = mess.get(cat,1,2,def);
  1019         string msg2 = mess.get(cat,1,6,def); // invalid msg #
  1020         string msg3 = mess.get(cat,2,1,def);
  1021 
  1022         mess.close(cat);
  1023         cout << msg0 << endl << msg1 << endl
  1024               << msg2 << endl << msg3 << endl;
  1025        }
  1026       else
  1027         cout << "Unable to open message catalog" << endl;*/
  1028 
  1029       //return KErrNone;	
  1030 }
  1031 
  1032 
  1033  catch(bad_alloc&)
  1034    {
  1035    	//do nothing
  1036     }
  1037    catch(...)
  1038    {
  1039    	failures++;
  1040    	
  1041    }
  1042    
  1043 		  if(failures  )
  1044 		  return KErrGeneral;
  1045 		  return KErrNone;
  1046     }
  1047 
  1048 // -----------------------------------------------------------------------------
  1049 // Ctlocale::collate
  1050 // collate  test method function.
  1051 //  
  1052 // -----------------------------------------------------------------------------
  1053 // 
  1054 TInt Ctlocale::collateL( CStifItemParser& aItem )
  1055 {
  1056  int failures =0;
  1057  try
  1058  {
  1059  	
  1060  
  1061  locale loc;
  1062  string s1("blue");
  1063  string s2("blues");
  1064   wstring ws1(L"blue");
  1065  wstring ws2(L"blues");
  1066  cout<<"";
  1067  #if  STDCPP_OOM
  1068 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1069   #endif 
  1070  const collate<char>& co =
  1071  use_facet<collate<char> >(loc);
  1072  
  1073  
  1074   const collate<wchar_t>& w_co =
  1075  use_facet<collate<wchar_t> >(loc);  //wchar
  1076     
  1077  if( co.compare(s1.begin(),s1.end(),s2.begin(),s2.end()-1) != 0)
  1078  failures++;
  1079                          
  1080  if( co.compare(s1.begin(),s1.end(), s2.begin(),s2.end()) != -1)
  1081  failures++;
  1082                          
  1083  // Retrieve hash values for two strings
  1084  if( co.hash(s1.begin(),s1.end())!= 15636)
  1085  failures++;
  1086  
  1087  //wchar
  1088     
  1089  if( w_co.compare(ws1.begin(),ws1.end(),ws2.begin(),ws2.end()-1) != 0)
  1090  failures++;
  1091                          
  1092  if( w_co.compare(ws1.begin(),ws1.end(), ws2.begin(),ws2.end()) != -1)
  1093  failures++;
  1094                          
  1095  // Retrieve hash values for two strings
  1096  if( w_co.hash(ws1.begin(),ws1.end())!= 15636)
  1097  failures++;
  1098    #if  STDCPP_OOM
  1099 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1100   #endif    
  1101   
  1102       
  1103       
  1104        
  1105 	
  1106 }
  1107 
  1108  catch(bad_alloc&)
  1109    {
  1110    	//do nothing
  1111     }
  1112    catch(...)
  1113    {
  1114    	failures++;
  1115    	
  1116    }
  1117    
  1118 		  if(failures  )
  1119 		  return KErrGeneral;
  1120 		  return KErrNone;
  1121     }
  1122 // -----------------------------------------------------------------------------
  1123 // Ctlocale::collatebyname
  1124 // collatebyname  test method function.
  1125 //  
  1126 // -----------------------------------------------------------------------------
  1127 // 
  1128 TInt Ctlocale::collatebyname( CStifItemParser& aItem )
  1129 {
  1130  int failures =0;
  1131  try
  1132  {
  1133  	
  1134  
  1135  locale loc;
  1136  string s1("blue");
  1137  string s2("blues");
  1138  
  1139   wstring ws1(L"blue");
  1140  wstring ws2(L"blues");
  1141  cout<<"";
  1142  #if  STDCPP_OOM
  1143 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1144   #endif 
  1145  const collate_byname<char>& co = use_facet<collate_byname<char> >(loc);
  1146  const collate_byname<wchar_t>& w_co = use_facet<collate_byname<wchar_t> >(loc);
  1147      
  1148  if( co.compare(s1.begin(),s1.end(),s2.begin(),s2.end()-1) != 0)
  1149  failures++;
  1150                          
  1151  if( co.compare(s1.begin(),s1.end(),  s2.begin(),s2.end()) != -1)
  1152  failures++;
  1153                          
  1154  // Retrieve hash values for two strings
  1155  if( co.hash(s1.begin(),s1.end())!= 15636)
  1156  failures++;
  1157  
  1158  //wchar
  1159     
  1160  if( w_co.compare(ws1.begin(),ws1.end(),ws2.begin(),ws2.end()-1) != 0)
  1161  failures++;
  1162                          
  1163  if( w_co.compare(ws1.begin(),ws1.end(), ws2.begin(),ws2.end()) != -1)
  1164  failures++;
  1165                          
  1166  // Retrieve hash values for two strings
  1167  if( w_co.hash(ws1.begin(),ws1.end())!= 15636)
  1168  failures++;
  1169    #if  STDCPP_OOM
  1170 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1171   #endif    
  1172   
  1173       
  1174       
  1175        
  1176 	
  1177 }
  1178 
  1179 
  1180  catch(bad_alloc&)
  1181    {
  1182    	//do nothing
  1183     }
  1184    catch(...)
  1185    {
  1186    	failures++;
  1187    	
  1188    }
  1189    
  1190 		  if(failures  )
  1191 		  return KErrGeneral;
  1192 		  return KErrNone;
  1193     }
  1194 
  1195 
  1196 
  1197 // -----------------------------------------------------------------------------
  1198 // Ctlocale::codecvt1
  1199 // codecvt1  test method function.
  1200 //  
  1201 // -----------------------------------------------------------------------------
  1202 // 
  1203 
  1204 TInt Ctlocale::codecvt1( CStifItemParser& aItem )
  1205 {
  1206 /*	locale loc ( "de_DE.ISO-8859-15" );
  1207 	int failures=0;
  1208 	try
  1209 	{
  1210 	cout<<"";	
  1211 	#if  STDCPP_OOM
  1212 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1213   #endif 
  1214     int result = use_facet<codecvt<char, char, mbstate_t> > ( loc ).encoding ();
  1215     if(result != 1)
  1216     failures++;
  1217    
  1218      
  1219   
  1220   
  1221     char* str = "This is the string whose length is to be measured!";
  1222     mbstate_t state = {0};
  1223     locale loc1("C");//English_Britain");//German_Germany
  1224    //int res = use_facet<codecvt<wchar_t, char, mbstate_t>>( loc ).length( state,str, &str[strlen(str)], 90 );
  1225 
  1226   
  1227     int res = use_facet<codecvt<wchar_t, char, mbstate_t> >
  1228      ( loc1 ).length( state,str, &str[strlen(str)], 90 );
  1229 
  1230   
  1231   
  1232     if(res!=50)
  1233     failures++;
  1234   
  1235   
  1236  
  1237      locale loc2( "C");//English_Britain" );//German_Germany
  1238      int res2 = use_facet<codecvt<char, char, mbstate_t> >
  1239      ( loc ).max_length( );
  1240      if(res2!=1)
  1241      failures++;
  1242 
  1243   
  1244    #if  STDCPP_OOM
  1245 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1246   #endif 
  1247     
  1248 }
  1249 
  1250 
  1251  catch(bad_alloc&)
  1252    {
  1253    	//do nothing
  1254     }
  1255    catch(...)
  1256    {
  1257    	failures++;
  1258    	
  1259    }
  1260    
  1261 		  if(failures  )
  1262 		  return KErrGeneral;*/
  1263 		  return KErrNone;
  1264     }
  1265 
  1266 // -----------------------------------------------------------------------------
  1267 // Ctlocale::codecvt2
  1268 // codecvt2 test method function.
  1269 //  
  1270 // -----------------------------------------------------------------------------
  1271 // 
  1272 TInt Ctlocale::codecvt2( CStifItemParser& aItem )
  1273 {
  1274 int failures=0;
  1275 try
  1276 {
  1277 	
  1278  
  1279  char strout[91];
  1280  wchar_t *strin = L"This is the wchar_t string to be converted.";
  1281  memset( &strout[0], 0, ( sizeof( char ) )*( 91 ) );
  1282  char* strnext;
  1283  const wchar_t* pwszNext;
  1284  mbstate_t state;
  1285  locale loc("C"); 
  1286  cout<<"";
  1287  #if  STDCPP_OOM
  1288 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1289   #endif 
  1290  int res = use_facet<codecvt<wchar_t, char, mbstate_t> >
  1291       ( loc ).out( state,strin, &strin[wcslen( strin )], pwszNext ,
  1292  strout, &strout[wcslen( strin )], strnext );
  1293  #if  STDCPP_OOM
  1294 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1295   #endif 
  1296  strout[wcslen( strin )] = 0;
  1297     
  1298   string str = "This is the wchar_t string to be converted.";
  1299  
  1300 /*if(str.compare(&strout[0]) == 0)
  1301 return KErrNone;
  1302 else
  1303 return KErrGeneral;
  1304 
  1305 */
  1306 
  1307 if(str.compare(&strout[0]) != 0)
  1308 failures++;
  1309 
  1310 }
  1311 
  1312 
  1313 
  1314 
  1315  catch(bad_alloc&)
  1316    {
  1317    	//do nothing
  1318     }
  1319    catch(...)
  1320    {
  1321    	failures++;
  1322    	
  1323    }
  1324    
  1325 		  if(failures  )
  1326 		  return KErrGeneral;
  1327 		  return KErrNone;
  1328     }
  1329 
  1330 
  1331 // -----------------------------------------------------------------------------
  1332 // Ctlocale::codecvtbyname1
  1333 // codecvtbyname1 test method function.
  1334 //  
  1335 // -----------------------------------------------------------------------------
  1336 // 
  1337 
  1338 TInt Ctlocale::codecvtbyname1( CStifItemParser& aItem )
  1339 {
  1340 /* locale loc ( "de_DE.ISO-8859-15" );
  1341  int failures=0;
  1342  try
  1343  {
  1344  cout<<"";	
  1345  #if  STDCPP_OOM
  1346 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1347   #endif 
  1348  int result = use_facet<codecvt_byname<char, char, mbstate_t> > ( loc ).encoding ();
  1349  #if  STDCPP_OOM
  1350 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1351   #endif 
  1352  if(result != 1)
  1353  failures++;
  1354  
  1355   
  1356  char* str = "This is the string whose length is to be measured!";
  1357  mbstate_t state = {0};
  1358  locale loc1("C"); 
  1359  
  1360   #if  STDCPP_OOM
  1361 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1362   #endif 
  1363   int res = use_facet<codecvt_byname<wchar_t, char, mbstate_t> >
  1364      ( loc1 ).length( state,str, &str[strlen(str)], 90 );
  1365 
  1366   #if  STDCPP_OOM
  1367 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1368   #endif 
  1369   
  1370   if(res!=50)
  1371   failures++;
  1372   
  1373    
  1374   
  1375  locale loc2( "C"); 
  1376  #if  STDCPP_OOM
  1377 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1378   #endif 
  1379  int res2 = use_facet<codecvt_byname<char, char, mbstate_t> >( loc ).max_length( );
  1380  #if  STDCPP_OOM
  1381 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1382   #endif 
  1383  if(res2!=1)
  1384  failures++;
  1385  
  1386   
  1387 }
  1388 
  1389 
  1390  catch(bad_alloc&)
  1391    {
  1392    	//do nothing
  1393     }
  1394    catch(...)
  1395    {
  1396    	failures++;
  1397    	
  1398    }
  1399    
  1400 		  if(failures  )
  1401 		  return KErrGeneral;*/
  1402 		  return KErrNone;
  1403     }
  1404 
  1405 
  1406 // -----------------------------------------------------------------------------
  1407 // Ctlocale::codecvtbyname2
  1408 // codecvtbyname2 test method function.
  1409 //  
  1410 // -----------------------------------------------------------------------------
  1411 // 
  1412 TInt Ctlocale::codecvtbyname2( CStifItemParser& aItem )
  1413 {
  1414 int failures=0;
  1415 try
  1416 {
  1417 	
  1418 
  1419  char* strout = "This is the string to be converted!";
  1420  wchar_t strin [91];
  1421  memset(&strin[0], 0, (sizeof(wchar_t))*(91));
  1422  const char* pszNext;
  1423  wchar_t* pwszNext;
  1424  mbstate_t state = {0};
  1425  locale loc("C"); 
  1426  cout<<"";
  1427  #if  STDCPP_OOM
  1428 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1429   #endif 
  1430  int res = use_facet<codecvt<wchar_t, char, mbstate_t> >
  1431      ( loc ).in( state, strout, &strout[strlen(strout)], pszNext,
  1432           strin, &strin[strlen(strout)], pwszNext );
  1433       #if  STDCPP_OOM
  1434 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1435   #endif     
  1436  strin[strlen(strout)] = 0;
  1437  
  1438  wstring str = L"This is the string to be converted!";
  1439 
  1440 /*
  1441 if(str.compare(&strin[0]) == 0)
  1442 return KErrNone;
  1443 else
  1444 return KErrGeneral;
  1445 
  1446    */
  1447  if(str.compare(&strin[0]) != 0)
  1448  failures++;
  1449   
  1450     
  1451 }
  1452 
  1453 
  1454  catch(bad_alloc&)
  1455    {
  1456    	//do nothing
  1457     }
  1458    catch(...)
  1459    {
  1460    	failures++;
  1461    	
  1462    }
  1463    
  1464 		  if(failures  )
  1465 		  return KErrGeneral;
  1466 		  return KErrNone;
  1467     }
  1468 
  1469 //cataloge
  1470 
  1471 TInt Ctlocale::catalog(CStifItemParser& aItem )
  1472     {
  1473     int failures=0;
  1474     try
  1475     {
  1476     	
  1477     
  1478   // __UHEAP_MARK;
  1479  
  1480    cout<<"";  
  1481  
  1482  #if  STDCPP_OOM
  1483 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1484   #endif 
  1485 // char* p = "c";
  1486 /*  const char* _Loc_ctype_default(p);
  1487    const char* _Loc_numeric_default(p) ;
  1488 	const char* _Loc_time_default(p) ;
  1489    const char* _Loc_collate_default(p) ;
  1490    const char* _Loc_monetary_default(p) ;
  1491    const char* _Loc_messages_default(p) ;*/
  1492    
  1493 /*    locale::category c;
  1494    //_Locale* L = "k";
  1495    const char* name1 = "catalog";
  1496     const char* name2="test";*/
  1497     
  1498             
  1499    const locale& L1= 0;
  1500    const locale& L2= 0;
  1501 //   const char* name = "testing";
  1502   // void _Stl_loc_combine_names(L,name1,name2,c);
  1503    //locale::locale(const locale& L1, const locale& L2, category c)
  1504    //locale::category c;
  1505   
  1506    
  1507   
  1508   //locale loc1(L1,name,c);
  1509   //locale loc(L1,L2,c);
  1510     
  1511 
  1512   #if  STDCPP_OOM
  1513 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1514   #endif 
  1515 
  1516 //__UHEAP_MARKEND;
  1517 /*
  1518  if(result)
  1519  return KErrNone;
  1520  else
  1521  return KErrGeneral;
  1522  */
  1523  
  1524  
  1525     }
  1526 
  1527 
  1528  catch(bad_alloc&)
  1529    {
  1530    	//do nothing
  1531     }
  1532    catch(...)
  1533    {
  1534    	failures++;
  1535    	
  1536    }
  1537    
  1538 		  if(failures  )
  1539 		  return KErrGeneral;
  1540 		  return KErrNone;
  1541     }
  1542     
  1543     
  1544     
  1545     //cataloge
  1546 
  1547 TInt Ctlocale::c_type(CStifItemParser& aItem )
  1548     {
  1549     int failures=0;
  1550     try
  1551     {
  1552     	
  1553     
  1554   // __UHEAP_MARK;
  1555  
  1556    cout<<"";  
  1557  
  1558  #if  STDCPP_OOM
  1559 User::__DbgSetAllocFail(FALSE,RHeap::EDeterministic,1);
  1560   #endif 
  1561   
  1562   
  1563   
  1564   locale loc1 ( "C" );
  1565    
  1566    char *string = "Hello, my name is John!";
  1567 //    wchar_t *wstring = L"Hello, my name is John!";
  1568 
  1569    const char* i = use_facet<ctype<char> > ( loc1 ).scan_is ( ctype_base::punct, &string[0], &string[strlen(&string[0])-1] );
  1570     // const wchar_t* wi = use_facet<ctype<wchar_t> > ( loc1 ).scan_is ( ctype_base::punct, &wstring[0], &wstring[strlen(&wstring[0])-1] );
  1571    const char* j = use_facet<ctype<char> > ( loc1 ).scan_not( ctype_base::alpha, &string[0], &string[strlen(&string[0])-1] );
  1572    if((*i)!= ',')
  1573    failures++;
  1574    
  1575     if((*j)!= ',')
  1576    failures++;
  1577     
  1578     
  1579     
  1580     
  1581     
  1582     //lower
  1583     
  1584     char string2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  1585     wchar_t wstring2[] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  1586 char to_lower = 'a';
  1587 wchar_t wto_lower = L'a';
  1588 
  1589    use_facet<ctype<char> > ( loc1 ).tolower( &string2[0], &string2[strlen(&string2[0])] );
  1590      use_facet<ctype<wchar_t> > ( loc1 ).tolower( &wstring2[0], &wstring2[27] );
  1591 
  1592    use_facet<ctype<char> > ( loc1 ).tolower(to_lower);
  1593      use_facet<ctype<wchar_t> > ( loc1 ).tolower(wto_lower);
  1594 //upper
  1595 
  1596   
  1597     char string3[] = "abcdefghijklmnopqrstuvwxyz";
  1598     wchar_t wstring3[] = L"abcdefghijklmnopqrstuvwxyz";
  1599 char to_upper = 'A';
  1600 
  1601 wchar_t wto_upper = L'A';
  1602 
  1603 char str2[16];
  1604 
  1605 //char test;
  1606    use_facet<ctype<char> > ( loc1 ).toupper( &string3[0], &string3[strlen(&string3[0])] );
  1607      use_facet<ctype<wchar_t> > ( loc1 ).toupper( &wstring3[0], &wstring3[27] );
  1608 
  1609    use_facet<ctype<char> > ( loc1 ).toupper(to_upper);
  1610      use_facet<ctype<wchar_t> > ( loc1 ).toupper(wto_upper);
  1611 
  1612 
  1613 
  1614  bool result1 = (use_facet<ctype<wchar_t> > ( loc1 ).narrow
  1615       (wstring3, wstring3 + wcslen(wstring3), 'X', &str2[0] ) != 0);
  1616       
  1617        bool result2 = (use_facet<ctype<char> > ( loc1 ).narrow
  1618       (string3, string3 + strlen(string3), 'X', &str2[0] ) != 0);
  1619       
  1620       	const ctype_base::mask* _get_classic_table();   
  1621       		const unsigned char*  _get_S_upper_table();
  1622       			const unsigned char*  _get_S_lower_table();
  1623       			void Dummy_API(void); 
  1624      //  ctype::narrow(to_upper,test);
  1625       
  1626       //char ctype<char>::do_narrow(char __c, char /* dfault */ ) 
  1627   #if  STDCPP_OOM
  1628 User::__DbgSetAllocFail(FALSE,RHeap::ENone,1);
  1629   #endif 
  1630 
  1631 //__UHEAP_MARKEND;
  1632 /*
  1633  if(result)
  1634  return KErrNone;
  1635  else
  1636  return KErrGeneral;
  1637  */
  1638  
  1639  
  1640     }
  1641 
  1642 
  1643  catch(bad_alloc&)
  1644    {
  1645    	//do nothing
  1646     }
  1647    catch(...)
  1648    {
  1649    	failures++;
  1650    	
  1651    }
  1652    
  1653 		  if(failures  )
  1654 		  return KErrGeneral;
  1655 		  return KErrNone;
  1656     }
  1657