os/ossrv/utilitylibraries/libutils/tsrc/nft/src/test_stringtohbufc16_positive.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/utilitylibraries/libutils/tsrc/nft/src/test_stringtohbufc16_positive.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,56 @@
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 <e32base.h>
1.24 +#include "libutils.h"
1.25 +#include"std_log_result.h"
1.26 +#define LOG_FILENAME_LINE __FILE__, __LINE__
1.27 +void main()
1.28 +{
1.29 + __UHEAP_MARK;
1.30 + {
1.31 + string s("hello");
1.32 + int retval =ESuccess;
1.33 + HBufC16 *buf = HBufC16::NewMaxL(12);
1.34 + CleanupStack::PushL(buf);
1.35 + wchar_t *wptr = new wchar_t[15];
1.36 + int i=0;
1.37 + while (i<=1000)
1.38 + {
1.39 + retval = StringToHbufc16(s, buf);
1.40 + i++;
1.41 + printf("%d\n",i);
1.42 + }
1.43 +
1.44 + if (retval == ESuccess)
1.45 + {
1.46 + printf("stringtorbuf16 Passed");
1.47 + }
1.48 + else
1.49 + {
1.50 + assert_failed = true;
1.51 + printf("stringtorbuf16 Failed");
1.52 + }
1.53 + CleanupStack::PopAndDestroy(1);
1.54 + delete []wptr;
1.55 + wptr = NULL;
1.56 + }
1.57 + __UHEAP_MARKEND;
1.58 + testResultXml("test_stringtohbufc16_positive");
1.59 +}