First public contribution.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 #include <StifParser.h>
23 #include <Stiftestinterface.h>
31 // ============================= LOCAL FUNCTIONS ===============================
33 // -----------------------------------------------------------------------------
34 // ?function_name ?description.
36 // Returns: ?value_1: ?description
37 // ?value_n: ?description_line1
39 // -----------------------------------------------------------------------------
43 ?arg_type arg, // ?description
44 ?arg_type arg) // ?description
54 // ============================ MEMBER FUNCTIONS ===============================
56 // -----------------------------------------------------------------------------
58 // Delete here all resources allocated and opened from test methods.
59 // Called from destructor.
60 // -----------------------------------------------------------------------------
62 void Ctutility::Delete()
67 // -----------------------------------------------------------------------------
68 // Ctutility::RunMethodL
69 // Run specified method. Contains also table of test mothods and their names.
70 // -----------------------------------------------------------------------------
72 TInt Ctutility::RunMethodL(
73 CStifItemParser& aItem )
76 static TStifFunctionInfo const KFunctions[] =
78 // Copy this line for every implemented function.
79 // First string is the function name used in TestScripter script file.
80 // Second is the actual implementation member function.
81 ENTRY( "Uninitialized_Copy", Ctutility::Uninitialized_Copy ),
82 ENTRY( "Uninitialized_Copy_n", Ctutility::Uninitialized_Copy_n ),
83 ENTRY( "Uninitialized_Fill", Ctutility::Uninitialized_Fill ),
84 ENTRY( "Uninitialized_Fill_n", Ctutility::Uninitialized_Fill_n ),
90 const TInt count = sizeof( KFunctions ) /
91 sizeof( TStifFunctionInfo );
93 return RunInternalL( KFunctions, count, aItem );
97 // -----------------------------------------------------------------------------
98 // Ctutility::Uninitialized_Copy
99 // Uninitialized_Copy test method function.
100 // (other items were commented in a header).
101 // -----------------------------------------------------------------------------
104 TInt Ctutility::Uninitialized_Copy( CStifItemParser& aItem )
108 int Array1[] = { 10, 20, 30, 40 };
109 const int N = sizeof( Array1 ) / sizeof( int );
113 Integer* ArrayPtr = ( Integer* )::operator new( N * sizeof( int ) );
114 Integer* LArrayPtr = uninitialized_copy(Array1, Array1 + N, ArrayPtr);
116 if ( ( &Array1[0] + N ) == ( void* )LArrayPtr )
121 if ( ( void* )LArrayPtr != ( void* )( ArrayPtr + N ) )
137 // -----------------------------------------------------------------------------
138 // Ctutility::Uninitialized_Copy_n
139 // Uninitialized_Copy_n test method function.
140 // (other items were commented in a header).
141 // -----------------------------------------------------------------------------
144 TInt Ctutility::Uninitialized_Copy_n( CStifItemParser& aItem )
148 int Array1[] = { 10, 20, 30, 40 };
149 const int N = sizeof( Array1 ) / sizeof( int );
153 Integer* ArrayPtr = ( Integer* )::operator new( N * sizeof( int ) );
154 std::pair<int*,Integer*> LArrayPtr = uninitialized_copy_n(Array1, N, ArrayPtr);
164 // -----------------------------------------------------------------------------
165 // Ctutility::Uninitialized_Fill
166 // Uninitialized_Fill test method function.
167 // (other items were commented in a header).
168 // -----------------------------------------------------------------------------
171 TInt Ctutility::Uninitialized_Fill( CStifItemParser& aItem )
175 int testfail = 0 , p = 0;
178 Integer* Array1 = ( Integer* )::operator new( N * sizeof( int ) );
179 uninitialized_fill( Array1, Array1 + N, val );
181 for ( int i = 0 ; i < N; i++ )
183 p = Array1[ i ].get( );
198 // -----------------------------------------------------------------------------
199 // Ctutility::Uninitialized_Fill_n
200 // Uninitialized_Fill_n test method function.
201 // (other items were commented in a header).
202 // -----------------------------------------------------------------------------
205 TInt Ctutility::Uninitialized_Fill_n( CStifItemParser& aItem )
209 int testfail = 0 , p = 0;
212 Integer* Array1 = ( Integer* )::operator new( N * sizeof( int ) );
213 uninitialized_fill_n( Array1, N, val );
215 for ( int i = 0 ; i < N; i++ )
217 p = Array1[ i ].get( );
232 // ========================== OTHER EXPORTED FUNCTIONS =========================