From eb08a9f06b782d1592d2972c6e5d72a80ccb5a21 Mon Sep 17 00:00:00 2001 From: Cory Date: Tue, 31 Oct 2023 10:52:16 +0100 Subject: [PATCH] Main and test suite --- src/main.cpp | 11 +++++++++++ src/test_suite.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/main.cpp create mode 100644 src/test_suite.cpp diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..73a1a22 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,11 @@ +#include "IsingModel.hpp" + +#include +#include + +int main() +{ + IsingModel test(5, 1.); + + return 0; +} diff --git a/src/test_suite.cpp b/src/test_suite.cpp new file mode 100644 index 0000000..b36d9e7 --- /dev/null +++ b/src/test_suite.cpp @@ -0,0 +1,29 @@ +#include "IsingModel.hpp" +#include "testlib.hpp" + +#include +#include + +class IsingModelTest { +public: + void test_constructor() + { + IsingModel test(3, 1.); + + arma::Mat a(3, 3); + std::function f = [](int x) { return x == 1 || x == -1; }; + // unmangled + int status = 0; + char *demangled = abi::__cxa_demangle(typeid(f).name(), 0, 0, &status); + std::cout << "Type: " << demangled << std::endl; + ASSERT(assert_each(f, test.lattice), + "Testing that lattices contain only 1 and -1"); + } +}; + +int main() +{ + IsingModelTest test; + + test.test_constructor(); +}