os/security/crypto/weakcryptospi/test/tbigint/tbigintmain.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 #include <e32base.h>
    20 #include "t_testhandler.h"
    21 #include "tScriptTests.h"
    22 #include "t_testsetup.h"
    23 #include "t_input.h"
    24 #include "t_output.h"
    25 #include "tbigint.h"
    26 #include "tconstructionfb.h"
    27 #include "tconstructionvector.h"
    28 #include "tbasicmathsvector.h"
    29 #include "tbasicmathsfb.h"
    30 #include "tmontgomeryvector.h"
    31 #include "tmontgomeryfb.h"
    32 #include "tprimevector.h"
    33 #include "tmontgomeryperformance.h"
    34 #include "tprimegenperformance.h"
    35 #include "tprimevectorperformance.h"
    36 #include "tprimegen.h"
    37 #include "tprimegenvector.h"
    38 #include <random.h>
    39 
    40 LOCAL_D void callExampleL() // initialize and call example code under cleanup stack
    41     {
    42     START_SCRIPT_LIST
    43 	SCRIPT_ITEM(CMontgomeryPerformance,_L8("MontgomeryPerformance")),
    44 	SCRIPT_ITEM(CPrimeVector,_L8("PrimeVector")),
    45 	SCRIPT_ITEM(CConstructionFB,_L8("ConstructionFB")),
    46 	SCRIPT_ITEM(CConstructionVector,_L8("ConstructionVector")),
    47 	SCRIPT_ITEM(CBasicMathsVector,_L8("BasicMathsVector")),
    48 	SCRIPT_ITEM(CBasicMathsFB,_L8("BasicMathsFB")),
    49 	SCRIPT_ITEM(CMontgomeryVector,_L8("MontgomeryVector")),
    50 	SCRIPT_ITEM(CMontgomeryFB,_L8("MontgomeryFB")),
    51 	SCRIPT_ITEM(CPrimeGenPerformance,_L8("PrimeGenPerformance")),
    52 	SCRIPT_ITEM(CPrimeVectorPerformance,_L8("PrimeVectorPerformance")),
    53 	SCRIPT_ITEM(CPrimeGen,_L8("PrimeGen")),
    54 	SCRIPT_ITEM(CPrimeGenVector,_L8("PrimeGenVector"))
    55 	END_SCRIPT_LIST
    56 
    57 //	Either run the top level build and test script or, if running this test specifically, 
    58 //	uncomment the following and it'll run them all one after the other
    59 
    60     CSystemRandom *rng = CSystemRandom::NewL();
    61     SetThreadRandomLC(rng);
    62 
    63 	TDriveUnit sysDrive (static_cast <TInt> (RFs::GetSystemDrive()));
    64 	TBuf<64> scriptFile = sysDrive.Name();
    65 	scriptFile.Append(_L("\\tbigint\\tbasicmathstests.txt"));
    66 	TBuf<64> logFile = sysDrive.Name();
    67 	logFile.Append(_L("\\tbigint\\tbasicmaths.log"));
    68 	
    69 	CTestSetup::CreateAndRunTestsL(theTestTypes, scriptFile, logFile);
    70 	
    71 /*	CTestSetup::CreateAndRunTestsL(theTestTypes, 
    72 		_L("c:\\tbigint\\tconstructiontests.txt"),
    73 		_L("c:\\tbigint\\tconstruction.log"));
    74 	CTestSetup::CreateAndRunTestsL(theTestTypes, 
    75 		_L("c:\\tbigint\\tprimegen.txt"),
    76 		_L("c:\\tbigint\\tprimegen.log"));
    77 	CTestSetup::CreateAndRunTestsL(theTestTypes, 
    78 		_L("c:\\tbigint\\tprimegenperformance.txt"),
    79 		_L("c:\\tbigint\\tprimegenperformance.log"));
    80 	CTestSetup::CreateAndRunTestsL(theTestTypes, 
    81 		_L("c:\\tbigint\\tmontgomerytests.txt"),
    82 		_L("c:\\tbigint\\tmontgomery.log"));
    83 	CTestSetup::CreateAndRunTestsL(theTestTypes, 
    84 		_L("c:\\tbigint\\tperformancetests.txt"),
    85 		_L("c:\\tbigint\\tperformance.log"));
    86 	CTestSetup::CreateAndRunTestsL(theTestTypes, 
    87 		_L("c:\\tbigint\\tprimetests.txt"),
    88 		_L("c:\\tbigint\\tprime.log"));
    89 	CTestSetup::CreateAndRunTestsL(theTestTypes, 
    90 		_L("c:\\tbigint\\tprimetests2.txt"),
    91 		_L("c:\\tbigint\\tprime2.log"));
    92 */
    93 	
    94 	DestroyThreadRandom();
    95 	CleanupStack::Pop(); // Pop the cleanup item which would have reset/delete the threadrandom
    96     }
    97 
    98 GLDEF_C TInt E32Main() // main function called by E32
    99     {
   100 	__UHEAP_MARK;
   101 	CTrapCleanup* cleanup = CTrapCleanup::New(); // get clean-up stack
   102 	TRAPD(error, callExampleL());
   103 	__ASSERT_ALWAYS(!error,User::Panic(_L("bigint"),error));
   104 	delete cleanup; // destroy clean-up stack
   105 	__UHEAP_MARKEND;
   106 	return 0;
   107     }