From 88cc5290095c2a0108f162d03496bca19aeb8e9e Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Fri, 16 Feb 2024 11:09:27 +0100 Subject: [PATCH] add solver test --- matricies/test/matrice1.test | 12 ++++++++++++ test/test_solver.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 matricies/test/matrice1.test create mode 100644 test/test_solver.cpp diff --git a/matricies/test/matrice1.test b/matricies/test/matrice1.test new file mode 100644 index 0000000..9d63899 --- /dev/null +++ b/matricies/test/matrice1.test @@ -0,0 +1,12 @@ +2 3 +1 2 3 +4 5 6 + +2 2 +0 1 +1 0 + +3 1 +1 +-2 +1 \ No newline at end of file diff --git a/test/test_solver.cpp b/test/test_solver.cpp new file mode 100644 index 0000000..b621d43 --- /dev/null +++ b/test/test_solver.cpp @@ -0,0 +1,26 @@ +#include "Solver.h" +#include +#include +#include +#include + +namespace fs = std::filesystem; + +int main() { + std::string path = "test"; + for (const auto& entry : fs::directory_iterator(path)) { + std::string fileName = entry.path().string(); + std::cout << "Opening " << fileName << " ...\n"; + std::ifstream in{fileName}; + Matrix mat{1, 1}, imageMat{1, 1}, noyauMat{1, 1}; + in >> mat >> imageMat >> noyauMat; + + Vect image{imageMat}; + Vect noyau{noyauMat}; + + Solver solver{mat}; + assert(solver.Image() == image); + assert(solver.Noyau() == noyau); + } + return 0; +} \ No newline at end of file