Skip to content

Commit 223232b

Browse files
distributed code from test.h and test.cpp to separate files, appears to be working for neohookean
1 parent 6a68d14 commit 223232b

File tree

5 files changed

+2212
-1
lines changed

5 files changed

+2212
-1
lines changed

Code/Source/solver/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ if(ENABLE_UNIT_TEST)
316316
# add test.cpp for unit test
317317

318318
# remove the main.cpp and add test.cpp
319-
set(TEST_SOURCES "../../../tests/unitTests/test.cpp")
319+
set(TEST_SOURCES
320+
"../../../tests/unitTests/test_material_neohookean.cpp"
321+
)
322+
320323
list(REMOVE_ITEM CSRCS "main.cpp")
321324
list(APPEND CSRCS ${TEST_SOURCES})
322325

tests/unitTests/test_common.h

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#ifndef TEST_COMMON_H
2+
#define TEST_COMMON_H
3+
4+
#include <stdlib.h>
5+
#include <iostream>
6+
#include <random>
7+
#include <chrono>
8+
#include "CepMod.h"
9+
#include "ComMod.h"
10+
#include "gtest/gtest.h"
11+
12+
13+
// --------------------------------------------------------------
14+
// -------------------- Mock svMultiPhysics object -------------------
15+
// --------------------------------------------------------------
16+
17+
18+
class MockCepMod : public CepMod {
19+
public:
20+
MockCepMod() {
21+
// initialize if needed
22+
}
23+
// Mock methods if needed
24+
};
25+
class MockdmnType : public dmnType {
26+
public:
27+
MockdmnType() {
28+
// initialize if needed
29+
}
30+
// MockstModelType mockStM;
31+
// Mock methods if needed
32+
};
33+
class MockmshType : public mshType {
34+
public:
35+
MockmshType() {
36+
// initialize if needed
37+
}
38+
// Mock methods if needed
39+
};
40+
class MockeqType : public eqType {
41+
public:
42+
MockeqType() {
43+
// initialize if needed
44+
}
45+
MockdmnType mockDmn;
46+
// Mock methods if needed
47+
};
48+
class MockComMod : public ComMod {
49+
public:
50+
MockComMod() {
51+
// initialize if needed
52+
nsd = 3;
53+
}
54+
MockeqType mockEq;
55+
MockmshType mockMsh;
56+
// Mock methods if needed
57+
};
58+
59+
60+
// --------------------------------------------------------------
61+
// --------------------Base class for testing ------------------------
62+
// --------------------------------------------------------------
63+
class TestBase {
64+
public:
65+
MockComMod com_mod;
66+
MockCepMod cep_mod;
67+
};
68+
69+
70+
#endif

0 commit comments

Comments
 (0)