os/mm/mmlibs/mmfw/tsrc/mmfunittest/SwCodecDevices/TSU_MMF_DeviceSuite.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // TSU_MMF_SwCodecDevicesSuite.cpp
    15 // This main DLL entry point for the TSU_MMF_SWCODECDEVICES.dll
    16 // 
    17 //
    18 
    19 // EPOC includes
    20 #include <e32base.h>
    21 
    22 // Test system includes
    23 #include "TSU_MMF_DeviceSuite.h"
    24 #include "TSU_MMF_SWCODECDEVICES.h"
    25 #include "tsu_mmf_CodecTests.h"
    26 #include "TSU_MMF_SignConversionCodecs.h"
    27 #include "TSU_MMF_Loop.h"
    28 #include "TSU_MMF_Oom.h"
    29 //[ actual codec includes ]
    30 #include "MmfPcm16toAlawhwDevice.h"
    31 #include "MmfALawToPcm16HwDevice.h"
    32 #include "GSM610.H"
    33 #include "MmfImaAdpcmtopcm16hwdevice.h"
    34 #include "MmfMuLawToPcm16hwDevice.h"
    35 #include "mmfpcm16SwapEndianhwdevice.h"
    36 #include "mmfpcm16ToImaAdpcm.h"
    37 #include "mmfpcm16toMulawhwdevice.h"
    38 #include "mmfpcm16topcmU16BEHwDevice.h"
    39 #include "MMFpcm16ToPcmU8HwDevice.h"
    40 #include "MMFpcm16ToPcmU8HwDevice.h"
    41 #include "mmfpcmS16PcmS8HwDevice.h"
    42 #include "mmfpcmS16topcmU16Codec.h"
    43 #include "mmfpcmS8ToPcmS16HwDevice.h"
    44 #include "mmfpcmU16BeToPcmS16HwDevice.h"
    45 #include "mmfpcmU16TopcmS16HwDevice.h"
    46 #include "MMFpcmU8ToPcm16HwDevice.h"
    47 
    48 
    49 /** 
    50  * NewTestSuite is exported at ordinal 1
    51  * this provides the interface to allow schedule test
    52  * to create instances of this test suite
    53  */
    54 EXPORT_C CTestSuite_MMF_SwCodecDevices* NewTestSuiteL() 
    55     { 
    56 	CTestSuite_MMF_SwCodecDevices* result = new (ELeave) CTestSuite_MMF_SwCodecDevices;
    57 	CleanupStack::PushL(result);
    58 	result->ConstructL();
    59 	CleanupStack::Pop(1, result); // result
    60 	return result;
    61     }
    62 
    63 //destructor
    64 CTestSuite_MMF_SwCodecDevices::~CTestSuite_MMF_SwCodecDevices()
    65 	{
    66 	}
    67 
    68 //Get Test Suite version
    69 _LIT(KTxtVersion,"0.1");
    70 TPtrC CTestSuite_MMF_SwCodecDevices::GetVersion( void )
    71 	{
    72 	return KTxtVersion();
    73 	}
    74 
    75 /** 
    76  *
    77  * Add a test step into the suite
    78  * @param	"CTestStep_MMF_SwCodecDevices* aPtrTestStep" 
    79  *			Test step pointer
    80  */
    81 void CTestSuite_MMF_SwCodecDevices::AddTestStepL( CTestStep_MMF_SwCodecDevices* aPtrTestStep )
    82 	{
    83 	// test steps contain a pointer back to the suite which owns them
    84 	aPtrTestStep->SetSuite(this);       
    85 	// add the step using tyhe base class method
    86 	CTestSuite::AddTestStepL(aPtrTestStep);
    87 	}
    88 
    89 /**
    90  * Constructor for test suite
    91  * this creates all the test steps and 
    92  * stores them inside CTestSuite_MMF_SWCODECDEVICES 
    93  */
    94 void CTestSuite_MMF_SwCodecDevices::InitialiseL( void )
    95 	{
    96 	// store the name of this test suite 
    97 	InitSystemPath();
    98 	iSuiteName = _L("TSU_MMF_SWCODECDEVICES");
    99 
   100 	AddTestStepL( new(ELeave) CTest_MMF_SwCodecDevices_U_0001() );
   101 	AddTestStepL( new(ELeave) CTest_MMF_SwCodecDevices_U_0002() );	
   102 	AddTestStepL( new(ELeave) CTest_MMF_SwCodecDevices_U_0003() );	
   103 	AddTestStepL( new(ELeave) CTestALawCodec_U_0004());
   104 	AddTestStepL( new(ELeave) CTestMuLawCodec_U_0006());
   105 
   106 	AddTestStepL( new(ELeave) CTestStepCodecUnitTest<CMMFPcm16SwapEndianCodec,TComparator,0,1,1>(0));
   107 	AddTestStepL( new(ELeave) CTestStepCodecUnitTest<CMMFPcm16ToImaAdpcmCodec,TComparator>(1) );
   108 	AddTestStepL( new(ELeave) CTestStepCodecUnitTest<CMMFImaAdpcmToPcm16Codec,TDbComparator<>,0,0,1>(2));
   109 	AddTestStepL( new(ELeave) CTestStepCodecUnitTest<CMMFPcm16ToPcmU8Codec,TComparator>(3));  
   110 	AddTestStepL( new(ELeave) CTestStepCodecUnitTest<CMMFPcmU8ToPcm16Codec,TDbComparator<>,0,0,1>(4));  
   111 	AddTestStepL( new(ELeave) CTestStepCodecUnitTest<CMMFPcm16ToPcmU8Codec,TComparator>(5));
   112 	
   113 	AddTestStepL( new(ELeave) CTestStepSignConversionTest<CMMFPcm16ToPcmU8Codec,CMMFPcm16ToPcmU8Generator,0>());
   114     AddTestStepL( new(ELeave) CTestStepSignConversionTest<CMMFPcm8ToPcm16Codec,CMMFPcm8ToPcm16Generator,1>());
   115     AddTestStepL( new(ELeave) CTestStepSignConversionTest<CMMFPcm16SwapEndianCodec,CMMFPcmU16toPcmU16BGenerator,2>());
   116     AddTestStepL( new(ELeave) CTestStepSignConversionTest<CMMFPcm16SwapEndianCodec,CMMFPcmU16BtoPcmU16Generator,3>());
   117 	AddTestStepL( new(ELeave) CTestStepSignConversionTest<CMMFPcmU8ToPcm16Codec,CMMFPcmU8ToPcm16Generator,4>());
   118 
   119 	AddTestStepL( new(ELeave) CTestIMaadCodec());
   120 
   121 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16ToALawCodec>(0));
   122     AddTestStepL( new(ELeave) CTestStepOomTest<CMMFAlawToPcm16Codec>(1));
   123 	AddTestStepL( new(ELeave) CTestStepGsm610ToPcm16OomTest(2));
   124 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFImaAdpcmToPcm16Codec>(3));
   125 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFMulawToPcm16Codec>(4));
   126 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16SwapEndianCodec>(5));
   127 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16ToImaAdpcmCodec>(6));
   128 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16ToMuLawCodec>(7));
   129 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16ToPcmU16BECodec>(8));
   130 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16ToPcmU8Codec>(9));
   131 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcmS16ToPcmS8Codec>(10));
   132 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16ToPcmU16CodecCodec>(11));
   133 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm8ToPcm16Codec>(12));
   134 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcmU16BeToPcmS16Codec>(13));
   135 	AddTestStepL( new(ELeave) CTestStepOomTest<CMMFPcm16ToPcmU16CodecCodec>(14));
   136 	AddTestStepL( new(ELeave) CTestStepPcm16ToGsm610OomTest(15));
   137 	
   138 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToALawCodec>(0));
   139     AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFAlawToPcm16Codec>(1));
   140 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFGsm610ToPcm16Codec>(2));
   141 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFImaAdpcmToPcm16Codec>(3));
   142 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFMulawToPcm16Codec>(4));
   143 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16SwapEndianCodec>(5));
   144 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToImaAdpcmCodec>(6));
   145 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToMuLawCodec>(7));
   146 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToPcmU16BECodec>(8));
   147 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToPcmU8Codec>(9));
   148 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcmS16ToPcmS8Codec>(10));
   149 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToPcmU16CodecCodec>(11));
   150 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm8ToPcm16Codec>(12));
   151 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcmU16BeToPcmS16Codec>(13));
   152 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToPcmU16CodecCodec>(14));
   153 	AddTestStepL( new(ELeave) CTestStepLoopTest<CMMFPcm16ToGsm610Codec>(15));
   154 	
   155 	}
   156 
   157 /**
   158 *
   159 * InitSystemPath
   160 * This sets up the default path
   161 * 
   162 */
   163 void CTestSuite_MMF_SwCodecDevices::InitSystemPath()
   164 	{
   165 	_LIT(KAudioStremOutSourcePathOnC,"c:\\mm\\mmf\\testfiles\\SwCodecDevices\\");
   166 
   167 	RFs fs;
   168 	TUint att;
   169 	TInt ret = fs.Connect();
   170 	__ASSERT_ALWAYS(ret == KErrNone,User::Panic(_L("Sys path not setup"),ret));
   171 
   172 	if (fs.Att(KAudioStremOutSourcePathOnC, att) == KErrNone)
   173 		iDefaultPath = KAudioStremOutSourcePathOnC;
   174 	else
   175 		User::Panic(_L("Test files not found"),KErrNotFound);
   176 
   177 	fs.Close();
   178 	}
   179 
   180 const TDesC& CTestSuite_MMF_SwCodecDevices::DefaultPath() const
   181 	{
   182 	return iDefaultPath;
   183 	}