Project-4/src/test_suite.cpp
2023-10-31 10:52:16 +01:00

30 lines
669 B
C++

#include "IsingModel.hpp"
#include "testlib.hpp"
#include <cxxabi.h>
#include <typeinfo>
class IsingModelTest {
public:
void test_constructor()
{
IsingModel test(3, 1.);
arma::Mat<int> a(3, 3);
std::function<bool(int)> 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();
}