persistentstorage/sqlite3api/TEST/sqliteTestUtl.cpp
changeset 0 08ec8eefde2f
child 23 26645d81f48d
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32test.h>
       
    17 #include <e32debug.h>
       
    18 #include <f32file.h>
       
    19 #include "sqliteTestUtl.h"
       
    20 
       
    21 static TBuf8<500> TheBuf8;
       
    22 static TBuf16<500> TheBuf16;
       
    23 
       
    24 static RTest TheTest(_L("t_sqliteapi test"));
       
    25 
       
    26 extern "C" void TestTitle(void)
       
    27 	{
       
    28 	TheTest.Title();
       
    29 	}
       
    30 
       
    31 extern "C" void TestStart(const char* title)
       
    32 	{
       
    33 	TPtrC8 p((const unsigned char*)title);
       
    34 	TheBuf16.Copy(p);
       
    35 	TheTest.Start(TheBuf16);
       
    36 	}
       
    37 
       
    38 extern "C" void TestNext(const char* title)
       
    39 	{
       
    40 	TPtrC8 p((const unsigned char*)title);
       
    41 	TheBuf16.Copy(p);
       
    42 	TheTest.Next(TheBuf16);
       
    43 	}
       
    44 
       
    45 extern "C" void TestClose(void)
       
    46 	{
       
    47 	TheTest.Close();	
       
    48 	}
       
    49 
       
    50 extern "C" void TestEnd(void)
       
    51 	{
       
    52 	TheTest.End();	
       
    53 	}
       
    54 
       
    55 extern "C" void TestAbort(int aLine)
       
    56 	{
       
    57 	TheTest(0, aLine);	
       
    58 	}
       
    59 
       
    60 extern "C" void TestHeapMark(void)
       
    61 	{
       
    62 	__UHEAP_MARK;
       
    63 	}
       
    64 
       
    65 extern "C" void TestHeapMarkEnd(void)
       
    66 	{
       
    67 	__UHEAP_MARKEND;
       
    68 	}
       
    69 
       
    70 extern "C" void Print(const char* msg)
       
    71 	{
       
    72 	TPtrC8 p((const unsigned char*)msg);
       
    73 	TheBuf16.Copy(p);
       
    74 	RDebug::Print(TheBuf16);
       
    75 	}
       
    76 
       
    77 extern "C" void PrintI(const char* fmt, int a1)
       
    78 	{
       
    79 	TPtrC8 p((const unsigned char*)fmt);
       
    80 	TheBuf16.Copy(p);
       
    81 	RDebug::Print(TheBuf16, a1);
       
    82 	}
       
    83 
       
    84 extern "C" void PrintIII(const char* fmt, int a1, int a2, int a3)
       
    85 	{
       
    86 	TPtrC8 p((const unsigned char*)fmt);
       
    87 	TheBuf16.Copy(p);
       
    88 	RDebug::Print(TheBuf16, a1, a2, a3);
       
    89 	}
       
    90 
       
    91 extern "C" void PrintII64I64(const char* fmt, int a1, __int64 a2, __int64 a3)
       
    92 	{
       
    93 	TPtrC8 p((const unsigned char*)fmt);
       
    94 	TheBuf16.Copy(p);
       
    95 	RDebug::Print(TheBuf16, a1, a2, a3);
       
    96 	}
       
    97 
       
    98 extern "C" void PrintSI(const char* fmt, const char* s, int a1)
       
    99 	{
       
   100 	TPtrC8 p((const unsigned char*)fmt);
       
   101 	TheBuf8.Format(TPtrC8((const TUint8*)fmt), s, a1);
       
   102 	TheBuf16.Copy(TheBuf8);
       
   103 	RDebug::Print(TheBuf16);
       
   104 	}
       
   105 
       
   106 extern "C" void PrintS(const char* fmt, const char* s)
       
   107 	{
       
   108 	TPtrC8 p((const unsigned char*)fmt);
       
   109 	TheBuf8.Format(TPtrC8((const TUint8*)fmt), s);
       
   110 	TheBuf16.Copy(TheBuf8);
       
   111 	RDebug::Print(TheBuf16);
       
   112 	}
       
   113 
       
   114 extern "C" void CreatePrivateDir(void)
       
   115 	{
       
   116 	RFs TheFs;
       
   117 	TInt err = TheFs.Connect();
       
   118 	TheTest(err == KErrNone);
       
   119 	err = TheFs.CreatePrivatePath(EDriveC);
       
   120 	TheFs.Close();
       
   121 	TheTest(err == KErrNone || err == KErrAlreadyExists);
       
   122 	}
       
   123