os/security/crypto/weakcryptospi/test/tcryptospi/src/hashpositiveobjectloadstep.cpp
Update contrib.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "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.
15 * Example CTestStep derived implementation
24 #include "hashpositiveobjectloadstep.h"
26 #include <cryptospi/cryptohashapi.h>
29 using namespace CryptoSpi;
31 CHashPositiveObjectLoadStep::~CHashPositiveObjectLoadStep()
36 CHashPositiveObjectLoadStep::CHashPositiveObjectLoadStep()
38 SetTestStepName(KHashPositiveObjectLoadStep);
42 TVerdict CHashPositiveObjectLoadStep::doTestStepPreambleL()
44 SetTestStepResult(EPass);
45 return TestStepResult();
49 TVerdict CHashPositiveObjectLoadStep::doTestStepL()
51 if (TestStepResult()==EPass)
54 //Assume faliure, unless all is successful
55 SetTestStepResult(EFail);
57 INFO_PRINTF1(_L("*** Hash - Positive Object Load ***"));
58 INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
60 TVariantPtrC algorithmUid;
61 TVariantPtrC operationModeUid;
63 //Extract the Test Case ID parameter from the specified INI file
64 if(!GetStringFromConfig(ConfigSection(),KConfigAlgorithmUid,algorithmUid) ||
65 !GetStringFromConfig(ConfigSection(),KConfigOperationMode,operationModeUid))
67 ERR_PRINTF1(_L("** Error: Failed to Load Configuration Parameters **"));
68 SetTestStepResult(EFail);
72 //Create and intialise a pointer for the Hash implementation object
73 CHash* hashImpl = NULL;
75 INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
77 //Retrieve a Hash factory object
78 TRAPD(err,CHashFactory::CreateHashL(hashImpl,
84 //If there are no errors (KErrNone) creating the Hash factory object, Pass the Test
85 if(hashImpl && (err == KErrNone))
87 INFO_PRINTF1(_L("*** Hash - Positive Object Load: PASS ***"));
89 SetTestStepResult(EPass);
93 ERR_PRINTF2(_L("*** FAIL: Failed to Create Hash Object - %d ***"), err);
94 SetTestStepResult(EFail);
98 INFO_PRINTF2(_L("HEAP CELLS: %d"), User::CountAllocCells());
101 return TestStepResult();
105 TVerdict CHashPositiveObjectLoadStep::doTestStepPostambleL()
108 return TestStepResult();