Main and test suite

This commit is contained in:
Cory Balaton 2023-10-31 10:52:16 +01:00
parent 1e4f6f2894
commit eb08a9f06b
No known key found for this signature in database
GPG Key ID: 3E5FCEBFD80F432B
2 changed files with 40 additions and 0 deletions

11
src/main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include "IsingModel.hpp"
#include <iostream>
#include <omp.h>
int main()
{
IsingModel test(5, 1.);
return 0;
}

29
src/test_suite.cpp Normal file
View File

@ -0,0 +1,29 @@
#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();
}