From 299981a478e39ec2334567ebad935f32caed0337 Mon Sep 17 00:00:00 2001 From: Carl Philipp Klemm <philipp@uvos.xyz> Date: Mon, 14 Oct 2024 17:12:15 +0200 Subject: [PATCH] test: add test for resample --- test.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test.cpp b/test.cpp index 6489ebc..0d5f026 100644 --- a/test.cpp +++ b/test.cpp @@ -523,6 +523,28 @@ bool testRemoveSeriesResistance() return true; } +bool testResize() +{ + try + { + eis::Spectra spectra = eis::Spectra::loadFromDisk("../rescaleTest.csv"); + std::vector<eis::DataPoint> data = eis::rescale(spectra.data, 50); + eis::removeDuplicates(data); + if(data.size() != 50) + { + eis::Log(eis::Log::ERROR)<<__func__<<"Resized data is of incorrect size"; + return false; + } + } + catch(eis::file_error& err) + { + eis::Log(eis::Log::ERROR)<<__func__<<" could not load ../rescaleTest.csv skipping test"; + return true; + } + + return true; +} + int main(int argc, char** argv) { eis::Log::headers = true; @@ -591,5 +613,8 @@ int main(int argc, char** argv) if(!testRemoveSeriesResistance()) return 21; + if(!testResize()) + return 22; + return 0; } -- GitLab