diff --git a/test/Common_Test.cpp b/test/Common_Test.cpp new file mode 100644 index 0000000..cc8332f --- /dev/null +++ b/test/Common_Test.cpp @@ -0,0 +1,42 @@ +#include + +#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:"<