cbsref/csyrefplugins/csy27010/test/Csy27010UnitTest.h
author hgs
Mon, 09 Aug 2010 17:35:42 +0100
changeset 58 980b3d0c4069
parent 44 8b72faa1200f
permissions -rw-r--r--
201027_10
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     1
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     2
// * Copyright 2004 Neusoft America Inc.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     3
// * All rights reserved.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     4
// * This component and the accompanying materials are made available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     5
// * under the terms of the Eclipse Public License v1.0
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     6
// * which accompanies this distribution, and is available
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     7
// * at the URL "http://www.eclipse.org/legal/epl-v10.html".
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     8
// *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
     9
// * Contributors:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    10
// * Keith Collins (Neusoft America Inc.)  original software development and additional code and modifications.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    11
// * Thomas Gahagen (Neusoft America Inc.)  additional code and modifications.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    12
// * Zhen Yuan (Neusoft America Inc.)  additional code and modifications.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    13
// *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    14
// * Description:  This defines the Unit Tests dealing with CSY 0710 related
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    15
// *               functionality as documented in the project's Unit Test Spec.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    16
// *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    17
// *               The tests may be run either interactively or automatically.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    18
// *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    19
// *               The tests are dependant on a predictable response from
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    20
// *               the BP side according to the test spec.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    21
// *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    22
// *               The automated tests achieve this predictable response by
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    23
// *               using the Tester component.
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    24
//
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    25
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    26
// Csy0710UnitTest.h
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    27
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    28
/** @file Csy0710UnitTest.h
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    29
 *
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    30
 */
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    31
 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    32
#ifndef CSY0710UNITTEST_H__
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    33
#define CSY0710UNITTEST_H__
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    34
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    35
#include "unitTestBase.h"
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    36
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    37
_LIT(KCsy0710UnitTest,       "Csy0710UnitTest");
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    38
_LIT(KCsy0710UnitTestLog,    "Csy0710UnitTestLog.txt");
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    39
_LIT(KCsy0710UnitTestScript, "Csy0710UnitTest.cpp;");
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    40
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    41
const TInt KMaxCommPorts = 4;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    42
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    43
const TInt  KMaxDataSessions = 3;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    44
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    45
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    46
class CCsy0710UnitTest : public CUnitTestBase
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    47
	{
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    48
public:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    49
	static void CreateTestL(); //NewL() is called within this function
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    50
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    51
	static CCsy0710UnitTest* NewL(const TDesC& aUnitTestName,
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    52
								  const TDesC& aLogFileName,
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    53
								  const TDesC& aTestSpecName,
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    54
								  const TDesC& aTestScriptName);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    55
	~CCsy0710UnitTest();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    56
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    57
private:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    58
	CCsy0710UnitTest(const TDesC& aUnitTestName,const TDesC& aLogFileName,
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    59
				 const TDesC& aTestSpecName,const TDesC& aTestScriptName);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    60
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    61
	void ConstructL();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    62
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    63
	// from CUnitTestBase
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    64
	virtual void RunTestsL(TBool aEndInd,TTestMode aTestMode,
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    65
						   TInt& aErrCode, TInt& aLeaveCode, 
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    66
		                   TInt aApiNumber,TInt aTestNumber);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    67
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    68
	// tests to be called within RunTestsL()
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    69
	TInt CsyAL(TInt aTstNum);  // 1
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    70
	TInt CsyBL(TInt aTstNum);  // 2
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    71
	TInt CsyCL(TInt aTstNum);  // 3
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    72
	TInt CsyDL(TInt aTstNum);  // 4
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    73
	TInt CsyEL(TInt aTstNum);  // 5
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    74
	TInt CsyFL(TInt aTstNum);  // 6
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    75
	TInt CsyGL(TInt aTstNum);  // 7
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    76
	TInt CsyHL(TInt aTstNum);  // 8
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    77
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    78
private:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    79
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    80
	void PrintTestSpecIdentifiers();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    81
	void PrintTestDetails(TInt aTstSpecNumber);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    82
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    83
	TBool HasTestRangesDefined();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    84
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    85
	// Helper functions
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    86
	void CloseAllResources();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    87
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    88
	TInt LoadSerialDeviceDrivers();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    89
	TInt OpenAllCommPorts();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    90
	TInt CloseAllCommPorts();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    91
	TInt GetCsyInfo();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    92
	TInt OpenCommPortFail();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    93
	TInt OpenCmdPortTwice();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    94
	TInt OpenCmdPortInvalidName();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    95
	TInt SendCmdOneCommPort(TInt aPortNum);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    96
	TInt SendCmdsOneCommPort(TInt aPortNum);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    97
	TInt CancelWriteOneCommPort(TInt aPortNum);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    98
	TInt RecvDataOneCommPort(TInt aPortNum);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
    99
	TInt ReadDataFromCommPort(TInt aPortNum);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   100
	TInt VerifyFlowControl(TInt aPortNum);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   101
	TInt Verify0710Compliance();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   102
	TInt VerifyStartup();
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   103
	TInt VerifyStartupFlowControl(TInt aPortNum);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   104
	TInt VerifyShutdown(TInt aTestSubset);
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   105
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   106
private:
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   107
	RCommServ   iCommServer;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   108
	RComm       iCommPort[KMaxCommPorts + 1];
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   109
	RComm		iDataPort;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   110
	TName       iCmdPortName[KMaxCommPorts];
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   111
	TName       iDataPort1Name;
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   112
	};
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   113
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   114
#endif//END Csy0710UnitTest_H__
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   115
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   116
8b72faa1200f 201024_02
hgs
parents:
diff changeset
   117