1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/utilitylibraries/libutils/tsrc/src/integration_test_scenario1.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 str1("Integration test");
1.31 + TPtrC8 buf1;
1.32 + int retval1 = 0, retval2 = 0,retval3 = 0,retval4,retval5,retval6;
1.33 + int ret =0 ;
1.34 + retval1 = StringToTptrc8(str1, buf1);
1.35 + printf("retval1 value is %d\n", retval1);
1.36 +
1.37 + TPtrC8 src1 = buf1;
1.38 + char *des1= new char[20];
1.39 + int size1=20;
1.40 + retval2= Tptrc8ToCharp(src1,des1,size1);
1.41 + printf("retval2 value is %d\n", retval2);
1.42 +
1.43 + char* src2 = des1;
1.44 + TBuf8 <20> des2;
1.45 + retval3 = CharToTbuf8 (src2, des2);
1.46 + printf("retval3 value is %d\n", retval3);
1.47 +
1.48 + TBuf8<20>src3= des2;
1.49 + wchar_t * des3= new wchar_t [20];
1.50 + int size2=20;
1.51 + retval4= Tbuf8ToWchar(src3,des3,size2);
1.52 + printf("retval4 value is %d\n", retval4);
1.53 +
1.54 + wchar_t* src4 = des3;
1.55 + TPtrC8 des4;
1.56 + char *size = new char[2*wcslen(src4)];
1.57 + retval5 = WcharpToTptrc8(src4, size ,des4);
1.58 + printf("retval5 value is %d\n", retval5);
1.59 +
1.60 + string str2;
1.61 + TPtrC8 src5 = des4;
1.62 + retval6 = Tptrc8ToString(src5, str2);
1.63 + printf("retval6 value is %d\n", retval6);
1.64 +
1.65 + ret= strncmp((char *)str1.c_str(),(char *)str2.c_str(),11);
1.66 + if(ret == ESuccess)
1.67 + {
1.68 + printf("integration_test1 passed\n");
1.69 + }
1.70 + else
1.71 + {
1.72 + printf("integration_test1 failed\n");
1.73 + assert_failed = true;
1.74 + }
1.75 + delete[] des1;
1.76 + delete[] des3;
1.77 + delete[] size;
1.78 + }
1.79 + __UHEAP_MARKEND;
1.80 + testResultXml("integration_test_scenario1");
1.81 + return 0;
1.82 +}