1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/crypto/weakcryptospi/test/tbigint/tbigintmain.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,107 @@
1.4 +/*
1.5 +* Copyright (c) 1998-2010 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 the License "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 +
1.22 +#include <e32base.h>
1.23 +#include "t_testhandler.h"
1.24 +#include "tScriptTests.h"
1.25 +#include "t_testsetup.h"
1.26 +#include "t_input.h"
1.27 +#include "t_output.h"
1.28 +#include "tbigint.h"
1.29 +#include "tconstructionfb.h"
1.30 +#include "tconstructionvector.h"
1.31 +#include "tbasicmathsvector.h"
1.32 +#include "tbasicmathsfb.h"
1.33 +#include "tmontgomeryvector.h"
1.34 +#include "tmontgomeryfb.h"
1.35 +#include "tprimevector.h"
1.36 +#include "tmontgomeryperformance.h"
1.37 +#include "tprimegenperformance.h"
1.38 +#include "tprimevectorperformance.h"
1.39 +#include "tprimegen.h"
1.40 +#include "tprimegenvector.h"
1.41 +#include <random.h>
1.42 +
1.43 +LOCAL_D void callExampleL() // initialize and call example code under cleanup stack
1.44 + {
1.45 + START_SCRIPT_LIST
1.46 + SCRIPT_ITEM(CMontgomeryPerformance,_L8("MontgomeryPerformance")),
1.47 + SCRIPT_ITEM(CPrimeVector,_L8("PrimeVector")),
1.48 + SCRIPT_ITEM(CConstructionFB,_L8("ConstructionFB")),
1.49 + SCRIPT_ITEM(CConstructionVector,_L8("ConstructionVector")),
1.50 + SCRIPT_ITEM(CBasicMathsVector,_L8("BasicMathsVector")),
1.51 + SCRIPT_ITEM(CBasicMathsFB,_L8("BasicMathsFB")),
1.52 + SCRIPT_ITEM(CMontgomeryVector,_L8("MontgomeryVector")),
1.53 + SCRIPT_ITEM(CMontgomeryFB,_L8("MontgomeryFB")),
1.54 + SCRIPT_ITEM(CPrimeGenPerformance,_L8("PrimeGenPerformance")),
1.55 + SCRIPT_ITEM(CPrimeVectorPerformance,_L8("PrimeVectorPerformance")),
1.56 + SCRIPT_ITEM(CPrimeGen,_L8("PrimeGen")),
1.57 + SCRIPT_ITEM(CPrimeGenVector,_L8("PrimeGenVector"))
1.58 + END_SCRIPT_LIST
1.59 +
1.60 +// Either run the top level build and test script or, if running this test specifically,
1.61 +// uncomment the following and it'll run them all one after the other
1.62 +
1.63 + CSystemRandom *rng = CSystemRandom::NewL();
1.64 + SetThreadRandomLC(rng);
1.65 +
1.66 + TDriveUnit sysDrive (static_cast <TInt> (RFs::GetSystemDrive()));
1.67 + TBuf<64> scriptFile = sysDrive.Name();
1.68 + scriptFile.Append(_L("\\tbigint\\tbasicmathstests.txt"));
1.69 + TBuf<64> logFile = sysDrive.Name();
1.70 + logFile.Append(_L("\\tbigint\\tbasicmaths.log"));
1.71 +
1.72 + CTestSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
1.73 +
1.74 +/* CTestSetup::CreateAndRunTestsL(theTestTypes,
1.75 + _L("c:\\tbigint\\tconstructiontests.txt"),
1.76 + _L("c:\\tbigint\\tconstruction.log"));
1.77 + CTestSetup::CreateAndRunTestsL(theTestTypes,
1.78 + _L("c:\\tbigint\\tprimegen.txt"),
1.79 + _L("c:\\tbigint\\tprimegen.log"));
1.80 + CTestSetup::CreateAndRunTestsL(theTestTypes,
1.81 + _L("c:\\tbigint\\tprimegenperformance.txt"),
1.82 + _L("c:\\tbigint\\tprimegenperformance.log"));
1.83 + CTestSetup::CreateAndRunTestsL(theTestTypes,
1.84 + _L("c:\\tbigint\\tmontgomerytests.txt"),
1.85 + _L("c:\\tbigint\\tmontgomery.log"));
1.86 + CTestSetup::CreateAndRunTestsL(theTestTypes,
1.87 + _L("c:\\tbigint\\tperformancetests.txt"),
1.88 + _L("c:\\tbigint\\tperformance.log"));
1.89 + CTestSetup::CreateAndRunTestsL(theTestTypes,
1.90 + _L("c:\\tbigint\\tprimetests.txt"),
1.91 + _L("c:\\tbigint\\tprime.log"));
1.92 + CTestSetup::CreateAndRunTestsL(theTestTypes,
1.93 + _L("c:\\tbigint\\tprimetests2.txt"),
1.94 + _L("c:\\tbigint\\tprime2.log"));
1.95 +*/
1.96 +
1.97 + DestroyThreadRandom();
1.98 + CleanupStack::Pop(); // Pop the cleanup item which would have reset/delete the threadrandom
1.99 + }
1.100 +
1.101 +GLDEF_C TInt E32Main() // main function called by E32
1.102 + {
1.103 + __UHEAP_MARK;
1.104 + CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
1.105 + TRAPD(error, callExampleL());
1.106 + __ASSERT_ALWAYS(!error,User::Panic(_L("bigint"),error));
1.107 + delete cleanup; // destroy clean-up stack
1.108 + __UHEAP_MARKEND;
1.109 + return 0;
1.110 + }