1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/utilitylibraries/libutils/tsrc/src/test_tptr16towstring_boundary1.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,59 @@
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 + wstring des(L"hellohello");
1.31 + int len = des.length();
1.32 + TPtr16 src((unsigned short *)"My wide string",14, 30);
1.33 + int retval=ESuccess;
1.34 + retval= Tptr16ToWstring(src,des);
1.35 +
1.36 + int tptrc_len = src.Length();
1.37 + int string_len = des.length();
1.38 + #ifdef __WINS__
1.39 + if(retval ==ESuccess && tptrc_len == string_len )
1.40 + {
1.41 + printf("Test tptr16towstring boundary1 passed\n");
1.42 + }
1.43 + else
1.44 + {
1.45 + assert_failed = true;
1.46 + printf("Test tptr16towstring boundary1 FAILURE\n");
1.47 + }
1.48 + #else
1.49 + if(retval ==ESuccess && (tptrc_len+1)/2 == string_len )
1.50 + {
1.51 + printf("Test tptr16towstring boundary1 passed\n");
1.52 + }
1.53 + else
1.54 + {
1.55 + assert_failed = true;
1.56 + printf("Test tptr16towstring boundary1 FAILURE\n");
1.57 + }
1.58 + #endif
1.59 + }
1.60 + __UHEAP_MARKEND;
1.61 + testResultXml("test_tptr16towstring_boundary1");
1.62 +}