Main and test suite
This commit is contained in:
parent
1e4f6f2894
commit
eb08a9f06b
11
src/main.cpp
Normal file
11
src/main.cpp
Normal 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
29
src/test_suite.cpp
Normal 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();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user