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