Skip to content

Commit 646cc90

Browse files
committed
Fix unit tests
- Set species:h:AA in AnomalousDiffusion test - Disable some tests if CHECKLEVEL is too low. These tests will fail because they expect an exception but checks are disabled.
1 parent b9f4adb commit 646cc90

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/unit/test_anomalous_diffusion.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ TEST_F(AnomalousDiffusionTest, ParticleDiffusion) {
5959
options["units"]["seconds"] = 1.0;
6060

6161
options["h"]["anomalous_D"] = 1.0; // Set particle diffusion for "h" species
62-
options["h"]["AA"] = 1.0; // Atomic mass number
63-
62+
6463
AnomalousDiffusion component("h", options, nullptr);
6564

6665
Options state;
6766
state["species"]["h"]["density"] =
6867
FieldFactory::get()->create3D("1 + y * (x - 0.5)", &options, mesh);
68+
state["species"]["h"]["AA"] = 1.0; // Atomic mass number
6969

7070
component.transform(state);
7171

tests/unit/test_component.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ TEST(ComponentTest, SetInteger) {
6262
ASSERT_EQ(getNonFinal<int>(option), 3);
6363
}
6464

65+
#if CHECKLEVEL >= 1
6566
TEST(ComponentTest, SetAfterGetThrows) {
6667
Options option;
6768

@@ -72,6 +73,7 @@ TEST(ComponentTest, SetAfterGetThrows) {
7273
// Setting after get should fail
7374
ASSERT_THROW(set<int>(option, 3), BoutException);
7475
}
76+
#endif
7577

7678
TEST(ComponentTest, SetAfterGetNonFinal) {
7779
Options option;
@@ -85,6 +87,7 @@ TEST(ComponentTest, SetAfterGetNonFinal) {
8587
ASSERT_EQ(getNonFinal<int>(option), 3);
8688
}
8789

90+
#if CHECKLEVEL >= 1
8891
TEST(ComponentTest, SetBoundaryAfterGetThrows) {
8992
Options option;
9093

@@ -96,6 +99,7 @@ TEST(ComponentTest, SetBoundaryAfterGetThrows) {
9699
// that all values are final including boundary cells.
97100
ASSERT_THROW(setBoundary<int>(option, 3), BoutException);
98101
}
102+
#endif
99103

100104
TEST(ComponentTest, SetBoundaryAfterGetNoBoundary) {
101105
Options option;
@@ -126,10 +130,12 @@ TEST(ComponentTest, GetAfterIsSetFinal) {
126130
ASSERT_EQ(get<int>(option["test"]), 1);
127131
}
128132

133+
#if CHECKLEVEL >= 1
129134
TEST(ComponentTest, SetAfterIsSetFinal) {
130135
Options option;
131136

132137
ASSERT_EQ(isSetFinal(option["test"]), false);
133138
// Can't now set the value
134139
ASSERT_THROW(set<int>(option["test"], 3), BoutException);
135140
}
141+
#endif

0 commit comments

Comments
 (0)