Converted to gtest, writing output files properly and no longer uses exceptions.
This test now runs and fails as a gtest should (previously it always exited with 0 even if the tests failed). The audio_coding_module_test target no longer uses exceptions in the generated project. Output files are written to our global output folder, using testsupport/fileutils.h. BUG= TEST=audio_coding_module_test on all platforms, in Debug+Release Review URL: http://webrtc-codereview.appspot.com/334004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1266 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -100,6 +100,7 @@
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'audio_coding_module',
|
||||
'<(webrtc_root)/../test/test.gyp:test_support_main',
|
||||
'<(webrtc_root)/../testing/gtest.gyp:gtest',
|
||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||
],
|
||||
@@ -121,18 +122,6 @@
|
||||
'../test/TwoWayCommunication.cpp',
|
||||
'../test/utility.cpp',
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="linux" or OS=="mac"', {
|
||||
'cflags': [
|
||||
'-fexceptions', # enable exceptions
|
||||
],
|
||||
}],
|
||||
['OS=="mac"', {
|
||||
'xcode_settings': {
|
||||
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', # -fexceptions
|
||||
}
|
||||
}],
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'audio_coding_unittests',
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "thread_wrapper.h"
|
||||
#include "tick_util.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "trace.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -32,7 +33,16 @@ namespace webrtc {
|
||||
#define NUMBER_OF_SENDER_TESTS 6
|
||||
|
||||
#define MAX_FILE_NAME_LENGTH_BYTE 500
|
||||
#define CHECK_THREAD_NULLITY(myThread, S) if(myThread != NULL){unsigned int i; (myThread)->Start(i);}else{throw S; exit(1);}
|
||||
#define CHECK_THREAD_NULLITY(myThread, S) \
|
||||
if(myThread != NULL) \
|
||||
{ \
|
||||
unsigned int i; \
|
||||
(myThread)->Start(i); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
ADD_FAILURE() << S; \
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@@ -261,7 +271,8 @@ APITest::SetUp()
|
||||
_inFileA.Open(fileName, frequencyHz, "rb", true);
|
||||
|
||||
//--- Output A
|
||||
strcpy(fileName, "./src/modules/audio_coding/main/test/outA.pcm");
|
||||
std::string outputFileA = webrtc::test::OutputPath() + "outA.pcm";
|
||||
strcpy(fileName, outputFileA.c_str());
|
||||
printf("Enter output file at side A [%s]: ", fileName);
|
||||
PCMFile::ChooseFile(fileName, 499, &frequencyHz);
|
||||
_outFileA.Open(fileName, frequencyHz, "wb");
|
||||
@@ -273,7 +284,8 @@ APITest::SetUp()
|
||||
_inFileB.Open(fileName, frequencyHz, "rb", true);
|
||||
|
||||
//--- Output B
|
||||
strcpy(fileName, "./src/modules/audio_coding/main/test/outB.pcm");
|
||||
std::string outputFileB = webrtc::test::OutputPath() + "outB.pcm";
|
||||
strcpy(fileName, outputFileB.c_str());
|
||||
printf("Enter output file at side B [%s]: ", fileName);
|
||||
PCMFile::ChooseFile(fileName, 499, &frequencyHz);
|
||||
_outFileB.Open(fileName, frequencyHz, "wb");
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "common_types.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "trace.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace webrtc {
|
||||
@@ -158,15 +159,14 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
if (testMode == 1) {
|
||||
playSampFreq=recvCodec.plfreq;
|
||||
//output file for current run
|
||||
sprintf(filename,"./src/modules/audio_coding/main/test/out%dFile.pcm",
|
||||
sprintf(filename,"%s/out%dFile.pcm", webrtc::test::OutputPath().c_str(),
|
||||
codeId);
|
||||
_pcmFile.Open(filename, recvCodec.plfreq, "wb+");
|
||||
} else if (testMode == 0) {
|
||||
playSampFreq=32000;
|
||||
//output file for current run
|
||||
sprintf(filename,
|
||||
"./src/modules/audio_coding/main/test/encodeDecode_out%d.pcm",
|
||||
codeId);
|
||||
sprintf(filename, "%s/encodeDecode_out%d.pcm",
|
||||
webrtc::test::OutputPath().c_str(), codeId);
|
||||
_pcmFile.Open(filename, 32000/*recvCodec.plfreq*/, "wb+");
|
||||
} else {
|
||||
printf("\nValid output frequencies:\n");
|
||||
@@ -174,8 +174,8 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream) {
|
||||
printf("which means output freq equal to received signal freq");
|
||||
printf("\n\nChoose output sampling frequency: ");
|
||||
ASSERT_GT(scanf("%d", &playSampFreq), 0);
|
||||
char fileName[] = "./src/modules/audio_coding/main/test/outFile.pcm";
|
||||
_pcmFile.Open(fileName, 32000, "wb+");
|
||||
sprintf(filename, "%s/outFile.pcm", webrtc::test::OutputPath().c_str());
|
||||
_pcmFile.Open(filename, 32000, "wb+");
|
||||
}
|
||||
|
||||
_realPayloadSizeBytes = 0;
|
||||
@@ -361,8 +361,8 @@ void EncodeDecodeTest::Perform() {
|
||||
|
||||
AudioCodingModule *acm = AudioCodingModule::Create(10);
|
||||
RTPFile rtpFile;
|
||||
char fileName[] = "outFile.rtp";
|
||||
rtpFile.Open(fileName, "rb");
|
||||
std::string fileName = webrtc::test::OutputPath() + "outFile.rtp";
|
||||
rtpFile.Open(fileName.c_str(), "rb");
|
||||
|
||||
_receiver.codeId = codeId;
|
||||
|
||||
@@ -389,8 +389,8 @@ void EncodeDecodeTest::EncodeToFile(int fileType, int codeId, int* codePars,
|
||||
int testMode) {
|
||||
AudioCodingModule *acm = AudioCodingModule::Create(0);
|
||||
RTPFile rtpFile;
|
||||
char fileName[] = "outFile.rtp";
|
||||
rtpFile.Open(fileName, "wb+");
|
||||
std::string fileName = webrtc::test::OutputPath() + "outFile.rtp";
|
||||
rtpFile.Open(fileName.c_str(), "wb+");
|
||||
rtpFile.WriteHeader();
|
||||
|
||||
//for auto_test and logging
|
||||
|
||||
@@ -160,7 +160,7 @@ PCMFile::ChooseFile(
|
||||
|
||||
void
|
||||
PCMFile::Open(
|
||||
char* filename,
|
||||
const char* filename,
|
||||
WebRtc_UWord16 frequency,
|
||||
const char* mode,
|
||||
bool autoRewind)
|
||||
@@ -168,8 +168,7 @@ PCMFile::Open(
|
||||
if ((_pcmFile = fopen(filename, mode)) == NULL)
|
||||
{
|
||||
printf("Cannot open file %s.\n", filename);
|
||||
throw "Unable to read file";
|
||||
exit(1);
|
||||
ADD_FAILURE() << "Unable to read file";
|
||||
}
|
||||
_frequency = frequency;
|
||||
_nSamples10Ms = (WebRtc_UWord16)(_frequency / 100);
|
||||
|
||||
@@ -29,7 +29,8 @@ public:
|
||||
fclose(_pcmFile);
|
||||
}
|
||||
}
|
||||
void Open(char *filename, WebRtc_UWord16 frequency, const char *mode, bool autoRewind = false);
|
||||
void Open(const char *filename, WebRtc_UWord16 frequency, const char *mode,
|
||||
bool autoRewind = false);
|
||||
|
||||
WebRtc_Word32 Read10MsData(AudioFrame& audioFrame);
|
||||
|
||||
@@ -41,7 +42,8 @@ public:
|
||||
void Close();
|
||||
bool EndOfFile() const { return _endOfFile; }
|
||||
void Rewind();
|
||||
static WebRtc_Word16 ChooseFile(char* fileName, WebRtc_Word16 maxLen, WebRtc_UWord16* frequencyHz);
|
||||
static WebRtc_Word16 ChooseFile(char* fileName, WebRtc_Word16 maxLen,
|
||||
WebRtc_UWord16* frequencyHz);
|
||||
static WebRtc_Word16 ChooseFile(char* fileName, WebRtc_Word16 maxLen);
|
||||
bool Rewinded();
|
||||
void SaveStereo(
|
||||
|
||||
@@ -141,12 +141,12 @@ RTPBuffer::EndOfFile() const
|
||||
return eof;
|
||||
}
|
||||
|
||||
void RTPFile::Open(char *filename, const char *mode)
|
||||
void RTPFile::Open(const char *filename, const char *mode)
|
||||
{
|
||||
if ((_rtpFile = fopen(filename, mode)) == NULL)
|
||||
{
|
||||
printf("Cannot write file %s.\n", filename);
|
||||
throw "Unable to write file";
|
||||
ADD_FAILURE() << "Unable to write file";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class RTPFile : public RTPStream
|
||||
public:
|
||||
~RTPFile(){}
|
||||
RTPFile() : _rtpFile(NULL),_rtpEOF(false) {}
|
||||
void Open(char *outFilename, const char *mode);
|
||||
void Open(const char *outFilename, const char *mode);
|
||||
void Close();
|
||||
void WriteHeader();
|
||||
void ReadHeader();
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "SpatialAudio.h"
|
||||
#include "utility.h"
|
||||
#include "trace.h"
|
||||
#include "common_types.h"
|
||||
#include "SpatialAudio.h"
|
||||
#include "trace.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@@ -66,20 +67,26 @@ SpatialAudio::Setup()
|
||||
|
||||
if(_testMode == 0)
|
||||
{
|
||||
strncpy(audioFileName, "./src/modules/audio_coding/main/test/out_spatial_autotest.pcm",
|
||||
std::string outputFile = webrtc::test::OutputPath() +
|
||||
"out_spatial_autotest.pcm";
|
||||
strncpy(audioFileName, outputFile.c_str(),
|
||||
MAX_FILE_NAME_LENGTH_BYTE - 1);
|
||||
}
|
||||
else if(_testMode == 1)
|
||||
{
|
||||
printf("\n");
|
||||
strncpy(audioFileName, "./src/modules/audio_coding/main/test/testspatial_out.pcm",
|
||||
std::string outputFile = webrtc::test::OutputPath() +
|
||||
"testspatial_out.pcm";
|
||||
strncpy(audioFileName, outputFile.c_str(),
|
||||
MAX_FILE_NAME_LENGTH_BYTE - 1);
|
||||
printf("Enter the output file [%s]: ", audioFileName);
|
||||
PCMFile::ChooseFile(audioFileName, MAX_FILE_NAME_LENGTH_BYTE, &sampFreqHz);
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy(audioFileName, "./src/modules/audio_coding/main/test/testspatial_out.pcm",
|
||||
std::string outputFile = webrtc::test::OutputPath() +
|
||||
"testspatial_out.pcm";
|
||||
strncpy(audioFileName, outputFile.c_str(),
|
||||
MAX_FILE_NAME_LENGTH_BYTE - 1);
|
||||
}
|
||||
_outFile.Open(audioFileName, sampFreqHz, "wb", false);
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
|
||||
#include "TestAllCodecs.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include "audio_coding_module_typedefs.h"
|
||||
#include "common_types.h"
|
||||
#include "engine_configurations.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "trace.h"
|
||||
#include "utility.h"
|
||||
|
||||
@@ -838,11 +840,9 @@ void TestAllCodecs::Run(TestPack* channel)
|
||||
|
||||
void TestAllCodecs::OpenOutFile(WebRtc_Word16 testNumber)
|
||||
{
|
||||
char fileName[500] = "testallcodecs_out_";
|
||||
char cntrStr[10];
|
||||
|
||||
sprintf(cntrStr, "%02d.pcm", testNumber);
|
||||
strcat(fileName, cntrStr);
|
||||
char fileName[500];
|
||||
sprintf(fileName, "%s/testallcodecs_out_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(), testNumber);
|
||||
_outFileB.Open(fileName, 32000, "wb");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
|
||||
#include "TestFEC.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include "audio_coding_module_typedefs.h"
|
||||
#include "common_types.h"
|
||||
#include "engine_configurations.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include "trace.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace webrtc {
|
||||
@@ -599,15 +600,18 @@ void TestFEC::Run()
|
||||
|
||||
void TestFEC::OpenOutFile(WebRtc_Word16 testNumber)
|
||||
{
|
||||
char fileName[500] = "./src/modules/audio_coding/main/test/TestFEC_outFile_";
|
||||
char cntrStr[10];
|
||||
char fileName[500];
|
||||
|
||||
if(_testMode == 0)
|
||||
{
|
||||
sprintf(fileName, "./src/modules/audio_coding/main/test/TestFEC_autoFile_");
|
||||
sprintf(fileName, "%s/TestFEC_autoFile_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(), testNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fileName, "%s/TestFEC_outFile_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(), testNumber);
|
||||
}
|
||||
sprintf(cntrStr, "%02d.pcm", testNumber);
|
||||
strcat(fileName, cntrStr);
|
||||
_outFileB.Open(fileName, 32000, "wb");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
|
||||
#include "TestStereo.h"
|
||||
|
||||
#include "common_types.h"
|
||||
#include "audio_coding_module_typedefs.h"
|
||||
#include "engine_configurations.h"
|
||||
#include <iostream>
|
||||
#include "utility.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include "audio_coding_module_typedefs.h"
|
||||
#include "common_types.h"
|
||||
#include "engine_configurations.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "trace.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@@ -528,12 +530,9 @@ void TestStereo::Run(TestPackStereo* channel)
|
||||
|
||||
void TestStereo::OpenOutFile(WebRtc_Word16 testNumber)
|
||||
{
|
||||
char fileName[500] = "./src/modules/audio_coding/main/test/teststereo_out_";
|
||||
char cntrStr[10];
|
||||
|
||||
sprintf(cntrStr, "%02d.pcm", testNumber);
|
||||
strcat(fileName, cntrStr);
|
||||
|
||||
char fileName[500];
|
||||
sprintf(fileName, "%s/teststereo_out_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(), testNumber);
|
||||
_outFileB.Open(fileName, 32000, "wb");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
|
||||
#include "TestVADDTX.h"
|
||||
|
||||
#include "common_types.h"
|
||||
#include "audio_coding_module_typedefs.h"
|
||||
#include "utility.h"
|
||||
#include "engine_configurations.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "audio_coding_module_typedefs.h"
|
||||
#include "common_types.h"
|
||||
#include "engine_configurations.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "trace.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@@ -351,15 +353,17 @@ void TestVADDTX::Run()
|
||||
|
||||
void TestVADDTX::OpenOutFile(WebRtc_Word16 testNumber)
|
||||
{
|
||||
char fileName[500] = "./src/modules/audio_coding/main/test/testVADDTX_outFile_";
|
||||
char cntrStr[10];
|
||||
|
||||
char fileName[500];
|
||||
if(_testMode == 0)
|
||||
{
|
||||
sprintf(fileName, "./src/modules/audio_coding/main/test/testVADDTX_autoFile_");
|
||||
sprintf(fileName, "%s/testVADDTX_autoFile_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(), testNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fileName, "%s/testVADDTX_outFile_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(), testNumber);
|
||||
}
|
||||
sprintf(cntrStr, "%02d.pcm", testNumber);
|
||||
strcat(fileName, cntrStr);
|
||||
_outFileB.Open(fileName, 16000, "wb");
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "audio_coding_module.h"
|
||||
@@ -16,6 +17,7 @@
|
||||
|
||||
#include "APITest.h"
|
||||
#include "EncodeDecodeTest.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "iSACTest.h"
|
||||
#include "SpatialAudio.h"
|
||||
#include "TestAllCodecs.h"
|
||||
@@ -23,6 +25,7 @@
|
||||
#include "TestStereo.h"
|
||||
#include "TestVADDTX.h"
|
||||
#include "TwoWayCommunication.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
|
||||
using webrtc::AudioCodingModule;
|
||||
using webrtc::Trace;
|
||||
@@ -48,7 +51,8 @@ void PopulateTests(std::vector<ACMTest*>* tests)
|
||||
{
|
||||
|
||||
Trace::CreateTrace();
|
||||
Trace::SetTraceFile("acm_trace.txt");
|
||||
std::string trace_file = webrtc::test::OutputPath() + "acm_trace.txt";
|
||||
Trace::SetTraceFile(trace_file.c_str());
|
||||
|
||||
printf("The following tests will be executed:\n");
|
||||
#ifdef ACM_AUTO_TEST
|
||||
@@ -98,7 +102,9 @@ void PopulateTests(std::vector<ACMTest*>* tests)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main()
|
||||
// TODO(kjellander): Make this a proper gtest instead of using this single test
|
||||
// to run all the tests.
|
||||
TEST(AudioCodingModuleTest, RunAllTests)
|
||||
{
|
||||
std::vector<ACMTest*> tests;
|
||||
PopulateTests(&tests);
|
||||
@@ -113,21 +119,10 @@ int main()
|
||||
printf("%s\n", version);
|
||||
for (it=tests.begin() ; it < tests.end(); it++)
|
||||
{
|
||||
try {
|
||||
|
||||
(*it)->Perform();
|
||||
}
|
||||
catch (char *except)
|
||||
{
|
||||
printf("Test failed with message: %s", except);
|
||||
getchar();
|
||||
return -1;
|
||||
}
|
||||
delete (*it);
|
||||
}
|
||||
|
||||
Trace::ReturnTrace();
|
||||
printf("ACM test completed\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "PCMFile.h"
|
||||
#include "trace.h"
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "utility.h"
|
||||
|
||||
namespace webrtc {
|
||||
@@ -211,7 +212,8 @@ WebRtc_Word16 TwoWayCommunication::SetUp()
|
||||
_inFileA.Open(fileName, frequencyHz, "rb");
|
||||
|
||||
//--- Output A
|
||||
strcpy(fileName, "outA.pcm");
|
||||
std::string outputFileA = webrtc::test::OutputPath() + "outA.pcm";
|
||||
strcpy(fileName, outputFileA.c_str());
|
||||
frequencyHz = 16000;
|
||||
printf("Enter output file at side A [%s]: ", fileName);
|
||||
ChooseFile(fileName, 499, &frequencyHz);
|
||||
@@ -228,7 +230,8 @@ WebRtc_Word16 TwoWayCommunication::SetUp()
|
||||
_inFileB.Open(fileName, frequencyHz, "rb");
|
||||
|
||||
//--- Output B
|
||||
strcpy(fileName, "outB.pcm");
|
||||
std::string outputFileB = webrtc::test::OutputPath() + "outB.pcm";
|
||||
strcpy(fileName, outputFileB.c_str());
|
||||
frequencyHz = 16000;
|
||||
printf("Enter output file at side B [%s]: ", fileName);
|
||||
ChooseFile(fileName, 499, &frequencyHz);
|
||||
@@ -316,11 +319,12 @@ WebRtc_Word16 TwoWayCommunication::SetUpAutotest()
|
||||
_inFileA.Open(fileName, frequencyHz, "rb");
|
||||
|
||||
//--- Output A
|
||||
strcpy(fileName, "./src/modules/audio_coding/main/test/outAutotestA.pcm");
|
||||
std::string outputFileA = webrtc::test::OutputPath() + "outAutotestA.pcm";
|
||||
strcpy(fileName, outputFileA.c_str());
|
||||
frequencyHz = 16000;
|
||||
_outFileA.Open(fileName, frequencyHz, "wb");
|
||||
strcpy(refFileName,
|
||||
"./src/modules/audio_coding/main/test/ref_outAutotestA.pcm");
|
||||
std::string outputRefFileA = webrtc::test::OutputPath() + "ref_outAutotestA.pcm";
|
||||
strcpy(refFileName, outputRefFileA.c_str());
|
||||
_outFileRefA.Open(refFileName, frequencyHz, "wb");
|
||||
|
||||
//--- Input B
|
||||
@@ -329,11 +333,12 @@ WebRtc_Word16 TwoWayCommunication::SetUpAutotest()
|
||||
_inFileB.Open(fileName, frequencyHz, "rb");
|
||||
|
||||
//--- Output B
|
||||
strcpy(fileName, "./src/modules/audio_coding/main/test/outAutotestB.pcm");
|
||||
std::string outputFileB = webrtc::test::OutputPath() + "outAutotestB.pcm";
|
||||
strcpy(fileName, outputFileB.c_str());
|
||||
frequencyHz = 16000;
|
||||
_outFileB.Open(fileName, frequencyHz, "wb");
|
||||
strcpy(refFileName,
|
||||
"./src/modules/audio_coding/main/test/ref_outAutotestB.pcm");
|
||||
std::string outputRefFileB = webrtc::test::OutputPath() + "ref_outAutotestB.pcm";
|
||||
strcpy(refFileName, outputRefFileB.c_str());
|
||||
_outFileRefB.Open(refFileName, frequencyHz, "wb");
|
||||
|
||||
//--- Set A-to-B channel
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "iSACTest.h"
|
||||
#include "utility.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include "testsupport/fileutils.h"
|
||||
#include "tick_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
@@ -200,20 +200,10 @@ ISACTest::Setup()
|
||||
}
|
||||
|
||||
_inFileA.Open(_fileNameSWB, 32000, "rb");
|
||||
if(_testMode == 0)
|
||||
{
|
||||
char fileNameA[] = "./src/modules/audio_coding/main/test/testisac_a.pcm";
|
||||
char fileNameB[] = "./src/modules/audio_coding/main/test/testisac_b.pcm";
|
||||
_outFileA.Open(fileNameA, 32000, "wb");
|
||||
_outFileB.Open(fileNameB, 32000, "wb");
|
||||
}
|
||||
else
|
||||
{
|
||||
char fileNameA[] = "./src/modules/audio_coding/main/test/testisac_a.pcm";
|
||||
char fileNameB[] = "./src/modules/audio_coding/main/test/testisac_b.pcm";
|
||||
_outFileA.Open(fileNameA, 32000, "wb");
|
||||
_outFileB.Open(fileNameB, 32000, "wb");
|
||||
}
|
||||
std::string fileNameA = webrtc::test::OutputPath() + "testisac_a.pcm";
|
||||
std::string fileNameB = webrtc::test::OutputPath() + "testisac_b.pcm";
|
||||
_outFileA.Open(fileNameA.c_str(), 32000, "wb");
|
||||
_outFileB.Open(fileNameB.c_str(), 32000, "wb");
|
||||
|
||||
while(!_inFileA.EndOfFile())
|
||||
{
|
||||
@@ -395,14 +385,16 @@ ISACTest::EncodeDecode(
|
||||
if(_testMode == 0)
|
||||
{
|
||||
sprintf(fileNameOut,
|
||||
"./src/modules/audio_coding/main/test/out_iSACTest_%s_%02d.pcm",
|
||||
"%s/out_iSACTest_%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"A",
|
||||
testNr);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fileNameOut,
|
||||
"./src/modules/audio_coding/main/test/out%s_%02d.pcm",
|
||||
"%s/out%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"A",
|
||||
testNr);
|
||||
}
|
||||
@@ -413,14 +405,16 @@ ISACTest::EncodeDecode(
|
||||
if(_testMode == 0)
|
||||
{
|
||||
sprintf(fileNameOut,
|
||||
"./src/modules/audio_coding/main/test/out_iSACTest_%s_%02d.pcm",
|
||||
"%s/out_iSACTest_%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"B",
|
||||
testNr);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fileNameOut,
|
||||
"./src/modules/audio_coding/main/test/out%s_%02d.pcm",
|
||||
"%s/out%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"B",
|
||||
testNr);
|
||||
}
|
||||
@@ -504,7 +498,8 @@ ISACTest::SwitchingSamplingRate(
|
||||
if(_testMode == 0)
|
||||
{
|
||||
sprintf(fileNameOut,
|
||||
"./src/modules/audio_coding/main/test/out_iSACTest_%s_%02d.pcm",
|
||||
"%s/out_iSACTest_%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"A",
|
||||
testNr);
|
||||
}
|
||||
@@ -513,7 +508,8 @@ ISACTest::SwitchingSamplingRate(
|
||||
printf("\nTest %d", testNr);
|
||||
printf(" Alternate between WB and SWB at the sender Side\n\n");
|
||||
sprintf(fileNameOut,
|
||||
"./src/modules/audio_coding/main/test/out%s_%02d.pcm",
|
||||
"%s/out%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"A",
|
||||
testNr);
|
||||
}
|
||||
@@ -524,13 +520,15 @@ ISACTest::SwitchingSamplingRate(
|
||||
if(_testMode == 0)
|
||||
{
|
||||
sprintf(fileNameOut,
|
||||
"./src/modules/audio_coding/main/test/out_iSACTest_%s_%02d.pcm",
|
||||
"%s/out_iSACTest_%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"B",
|
||||
testNr);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(fileNameOut, "./src/modules/audio_coding/main/test/out%s_%02d.pcm",
|
||||
sprintf(fileNameOut, "%s/out%s_%02d.pcm",
|
||||
webrtc::test::OutputPath().c_str(),
|
||||
"B",
|
||||
testNr);
|
||||
}
|
||||
|
||||
@@ -12,28 +12,21 @@
|
||||
#define ACM_TEST_UTILITY_H
|
||||
|
||||
#include "audio_coding_module.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
//-----------------------------
|
||||
#define CHECK_ERROR(f) \
|
||||
do { \
|
||||
if(f < 0) { \
|
||||
char errString[500]; \
|
||||
sprintf(errString, "Error Calling API in file %s at line %d \n", \
|
||||
__FILE__, __LINE__); \
|
||||
throw errString; \
|
||||
} \
|
||||
EXPECT_GE(f, 0) << "Error Calling API"; \
|
||||
}while(0)
|
||||
|
||||
//-----------------------------
|
||||
#define CHECK_PROTECTED(f) \
|
||||
do { \
|
||||
if(f >= 0) { \
|
||||
char errString[500]; \
|
||||
sprintf(errString, "Error Calling API in file %s at line %d \n", \
|
||||
__FILE__, __LINE__); \
|
||||
throw errString; \
|
||||
ADD_FAILURE() << "Error Calling API"; \
|
||||
} \
|
||||
else { \
|
||||
printf("An expected error is caught.\n"); \
|
||||
|
||||
Reference in New Issue
Block a user