Skip to content

Commit a754f9e

Browse files
committed
fresh unit test according to refactor
1 parent 5d9836c commit a754f9e

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

source/module_cell/module_neighbor/test/sltk_atom_arrange_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ TEST_F(SltkAtomArrangeTest, setsrNL)
8888
std::ofstream ofs;
8989
ofs.open("./to_test_arrange.txt");
9090
test_sr = test.set_sr_NL(ofs, teststring, rcutmax_Phi, rcutmax_Beta, gamma_only_local);
91-
EXPECT_DOUBLE_EQ(test_sr, 2.01);
91+
EXPECT_DOUBLE_EQ(test_sr, 2.001);
9292

9393
gamma_only_local = false;
9494
test_sr = test.set_sr_NL(ofs, teststring, rcutmax_Phi, rcutmax_Beta, gamma_only_local);
95-
EXPECT_DOUBLE_EQ(test_sr, 6.01);
95+
EXPECT_DOUBLE_EQ(test_sr, 6.001);
9696

9797
const std::string teststring2 = "no";
9898
test_sr = test.set_sr_NL(ofs, teststring2, rcutmax_Phi, rcutmax_Beta, gamma_only_local);

source/module_cell/module_neighbor/test/sltk_atom_input_test.cpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,10 @@ TEST_F(SltkAtomInputTest, Constructor)
107107
ofs.close();
108108
ifs.open("test.out");
109109
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
110-
EXPECT_THAT(str, testing::HasSubstr("ntype = 1"));
111-
EXPECT_THAT(str, testing::HasSubstr("Amount(atom number) = 2"));
112110
EXPECT_THAT(str, testing::HasSubstr("Periodic_boundary = 1"));
113111
EXPECT_THAT(str, testing::HasSubstr("Searching radius(lat0) = 2.55"));
114-
// EXPECT_THAT(str, testing::HasSubstr("CellLength(unit: lat0) = [ 0.707107, 0.707107, 0.707107 ]"));
115-
EXPECT_THAT(str, testing::HasSubstr("min_tau = [ -0.75, 0, 0 ]"));
116-
EXPECT_THAT(str, testing::HasSubstr("max_tau = [ 0, 0.75, 0.75 ]"));
117112
EXPECT_THAT(str, testing::HasSubstr("glayer+ = [ 6, 6, 6 ]"));
118113
EXPECT_THAT(str, testing::HasSubstr("glayer- = [ 5, 5, 5 ]"));
119-
EXPECT_THAT(str, testing::HasSubstr("CellDim = [ 11, 11, 11 ]"));
120114
ifs.close();
121115
remove("test.out");
122116
}
@@ -138,6 +132,7 @@ TEST_F(SltkAtomInputTest, Getters)
138132
ofs.close();
139133
remove("test.out");
140134
}
135+
/*
141136
142137
TEST_F(SltkAtomInputDeathTest, ConstructorWarning1)
143138
{
@@ -154,7 +149,6 @@ TEST_F(SltkAtomInputDeathTest, ConstructorWarning1)
154149
ofs.close();
155150
remove("test.out");
156151
}
157-
/*
158152
TEST_F(SltkAtomInputDeathTest, ConstructorWarning2)
159153
{
160154
ofs.open("test.out");
@@ -216,14 +210,9 @@ TEST_F(SltkAtomInputTest, ConstructorNoExpand)
216210
ofs.close();
217211
ifs.open("test.out");
218212
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
219-
EXPECT_THAT(str, testing::HasSubstr("ntype = 1"));
220-
EXPECT_THAT(str, testing::HasSubstr("Amount(atom number) = 2"));
221213
EXPECT_THAT(str, testing::HasSubstr("Periodic_boundary = 1"));
222214
EXPECT_THAT(str, testing::HasSubstr("Searching radius(lat0) = 0"));
223-
// EXPECT_THAT(str, testing::HasSubstr("CellLength(unit: lat0) = [ 0.707107, 0.707107, 0.707107 ]"));
224-
EXPECT_THAT(str, testing::HasSubstr("min_tau = [ -0.75, 0, 0 ]"));
225-
EXPECT_THAT(str, testing::HasSubstr("max_tau = [ 0, 0.75, 0.75 ]"));
226-
EXPECT_THAT(str, testing::HasSubstr("glayer+ = [ 2, 2, 2 ]"));
215+
EXPECT_THAT(str, testing::HasSubstr("glayer+ = [ 1, 1, 1 ]"));
227216
EXPECT_THAT(str, testing::HasSubstr("glayer- = [ 0, 0, 0 ]"));
228217
ifs.close();
229218
remove("test.out");
@@ -240,16 +229,10 @@ TEST_F(SltkAtomInputTest, ConstructorSmallSearchRadius)
240229
ofs.close();
241230
ifs.open("test.out");
242231
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
243-
EXPECT_THAT(str, testing::HasSubstr("ntype = 1"));
244-
EXPECT_THAT(str, testing::HasSubstr("Amount(atom number) = 2"));
245232
EXPECT_THAT(str, testing::HasSubstr("Periodic_boundary = 1"));
246233
EXPECT_THAT(str, testing::HasSubstr("Searching radius(lat0) = 0.5"));
247-
// EXPECT_THAT(str, testing::HasSubstr("CellLength(unit: lat0) = [ 0.707107, 0.707107, 0.707107 ]"));
248-
EXPECT_THAT(str, testing::HasSubstr("min_tau = [ -0.75, 0, 0 ]"));
249-
EXPECT_THAT(str, testing::HasSubstr("max_tau = [ 0, 0.75, 0.75 ]"));
250234
EXPECT_THAT(str, testing::HasSubstr("glayer+ = [ 2, 2, 2 ]"));
251-
EXPECT_THAT(str, testing::HasSubstr("glayer- = [ 2, 2, 2 ]"));
252-
EXPECT_THAT(str, testing::HasSubstr("CellDim = [ 4, 4, 4 ]"));
235+
EXPECT_THAT(str, testing::HasSubstr("glayer- = [ 1, 1, 1 ]"));
253236
ifs.close();
254237
remove("test.out");
255238
}

source/module_cell/module_neighbor/test/sltk_grid_test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ TEST_F(SltkGridTest, InitSmall)
112112
EXPECT_DOUBLE_EQ(LatGrid.sradius, 0.5);
113113

114114
// minimal value of x, y, z
115-
EXPECT_DOUBLE_EQ(LatGrid.true_cell_x, 2);
116-
EXPECT_DOUBLE_EQ(LatGrid.true_cell_y, 2);
117-
EXPECT_DOUBLE_EQ(LatGrid.true_cell_z, 2);
115+
EXPECT_DOUBLE_EQ(LatGrid.true_cell_x, 1);
116+
EXPECT_DOUBLE_EQ(LatGrid.true_cell_y, 1);
117+
EXPECT_DOUBLE_EQ(LatGrid.true_cell_z, 1);
118118
// number of cells in x, y, z
119-
EXPECT_EQ(LatGrid.cell_nx, 4);
120-
EXPECT_EQ(LatGrid.cell_ny, 4);
121-
EXPECT_EQ(LatGrid.cell_nz, 4);
119+
EXPECT_EQ(LatGrid.cell_nx, 3);
120+
EXPECT_EQ(LatGrid.cell_ny, 3);
121+
EXPECT_EQ(LatGrid.cell_nz, 3);
122122
ofs.close();
123123
remove("test.out");
124124
}

0 commit comments

Comments
 (0)