1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/utilitylibraries/libutils/tsrc/src/integration_test_scenario2.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,79 @@
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 + __UHEAP_MARK;
1.29 + {
1.30 + string src1("@#$%^^&");
1.31 + TPtr8 des1((unsigned char *)"",30);
1.32 + int retval1, retval2,retval3,retval4,retval5,retval6;
1.33 + int ret;
1.34 + retval1 = StringToTptr8(src1, des1);
1.35 + printf("retval1 value is %d\n", retval1);
1.36 +
1.37 + TPtr8 src2 = des1;
1.38 + char *des2= new char[30];
1.39 + int size1=30;
1.40 + retval2= Tptr8ToChar(src2,des2,size1);
1.41 + printf("retval2 value is %d\n", retval2);
1.42 +
1.43 + char* src3 = des2;
1.44 + TBuf8 <30> des3;
1.45 + retval3 = CharToTbuf8 (src3, des3);
1.46 + printf("retval3 value is %d\n", retval3);
1.47 +
1.48 + TBuf8<30>src4= des3;
1.49 + wchar_t * des4= new wchar_t [30];
1.50 + int size2=30;
1.51 + retval4= Tbuf8ToWchar(src4,des4,size2);
1.52 + printf("retval4 value is %d\n", retval4);
1.53 +
1.54 + wchar_t* src5 = des4;
1.55 + TPtr8 des5((unsigned char *)" ",50);
1.56 + char * cPtr= new char[50];
1.57 + retval5 = WcharpToTptr8(src5,cPtr,des5);
1.58 + printf("retval5 value is %d\n", retval5);
1.59 +
1.60 + string des6("");
1.61 + TPtr8 src6 = des5;
1.62 + retval6 = Tptr8ToString(src6, des6);
1.63 + printf("retval6 value is %d\n", retval6);
1.64 +
1.65 + ret= strncmp((char *)src1.c_str(),(char *)des6.c_str(),11);
1.66 + if(ret == ESuccess)
1.67 + {
1.68 + printf("integration_test2 passed\n");
1.69 + }
1.70 + else
1.71 + {
1.72 + printf("integration_test2 failed\n");
1.73 + assert_failed = true;
1.74 + }
1.75 + delete[] des2;
1.76 + delete[] des4;
1.77 + delete[] cPtr;
1.78 + }
1.79 + __UHEAP_MARKEND;
1.80 + testResultXml("integration_test_scenario2");
1.81 + return 0;
1.82 +}