1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/utilitylibraries/libutils/tsrc/src/integration_test_scenario3.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,80 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#include <stdio.h>
1.22 +#include<e32std.h>
1.23 +#include "libutils.h"
1.24 +#include"std_log_result.h"
1.25 +#define LOG_FILENAME_LINE __FILE__, __LINE__
1.26 +int main()
1.27 +{
1.28 + char * src1="test";
1.29 + HBufC8 *des1= HBufC8::NewMaxL(20);
1.30 + int ret,retval1,retval2,retval3,retval4,retval5,retval6;
1.31 + int /*size1=20,*/size2=20,size3=20;
1.32 + __UHEAP_MARK;
1.33 + {
1.34 + retval1= CharToHbufc8(src1,des1);
1.35 + printf("retval1 value is %d\n", retval1);
1.36 +
1.37 + string des2("test");
1.38 + HBufC8 *src2= des1;
1.39 + retval2= Hbufc8ToString(src2,des2);
1.40 + printf("retval2 value is %d\n", retval2);
1.41 +
1.42 + string src3=des2;
1.43 + TPtr8 des3((unsigned char *)" ",20);
1.44 + retval3 = StringToTptr8(src3, des3);
1.45 + printf("retval3 value is %d\n", retval3);
1.46 +
1.47 + TPtr8 src4 = des3;
1.48 + wchar_t *des4= new wchar_t[42];
1.49 + retval4= Tptr8ToWcharp(src4,des4,size2);
1.50 + printf("retval4 value is %d\n", retval4);
1.51 +
1.52 + wchar_t* src5=des4;
1.53 + TPtr8 des5((unsigned char*)" ",42);
1.54 + char * cPtr= new char[30];
1.55 + retval5=WcharpToTptr8(src5,cPtr,des5);
1.56 + printf("retval5 value is %d\n", retval5);
1.57 +
1.58 + TPtr8 src6 = des5;
1.59 + char *des6= new char[42];
1.60 + retval6= Tptr8ToChar(src6,des6,size3);
1.61 + printf("retval6 value is %d\n", retval6);
1.62 +
1.63 + ret= strncmp((char*)src1,(char*)des6,4);
1.64 + if(ret == ESuccess)
1.65 + {
1.66 + printf("integration_test3 passed\n");
1.67 + }
1.68 + else
1.69 + {
1.70 + printf("integration_test3 failed\n");
1.71 + assert_failed = true;
1.72 + }
1.73 + delete[] des4;
1.74 + des4=NULL;
1.75 + delete[] des6;
1.76 + des6=NULL;
1.77 + delete[] cPtr;
1.78 + delete des1;
1.79 + }
1.80 + __UHEAP_MARKEND;
1.81 + testResultXml("integration_test_scenario3");
1.82 + return 0;
1.83 +}