Add Common_Test, add adaptFrequency test.
This commit is contained in:
42
test/Common_Test.cpp
Normal file
42
test/Common_Test.cpp
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include "common/ceMatchedFilterHandling.h"
|
||||||
|
#include "MatlabReader.h"
|
||||||
|
|
||||||
|
inline double fourDecimalRound(double src){
|
||||||
|
return round(src*10000.0)/10000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define EXPECT_DOUBLE_AE(valueA,valueB)\
|
||||||
|
EXPECT_DOUBLE_EQ(fourDecimalRound(valueA),fourDecimalRound(valueB))
|
||||||
|
|
||||||
|
class Common_Test : public ::testing::Test {
|
||||||
|
protected:
|
||||||
|
static void SetUpCommonTester() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TearDownTestCase() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void TearDown() {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(Common_Test, adaptFrequency) {
|
||||||
|
// MatlabReader m("/home/krad/TestData/adaptFrequency.mat");
|
||||||
|
MatlabReader m("/home/sun/Aurora/build/a.mat");
|
||||||
|
|
||||||
|
auto mCe = m.read("input");
|
||||||
|
mCe = Recon::adaptFrequency(mCe,40000000.0,10000000.0);
|
||||||
|
EXPECT_EQ(4096,mCe.getDataSize());
|
||||||
|
auto output = m.read("output");
|
||||||
|
for (size_t i = 0; i < 4096; i++)
|
||||||
|
{
|
||||||
|
EXPECT_DOUBLE_AE(mCe.getData()[i],output.getData()[i])<<", index:"<<i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user