Skip to content

Commit ad986d1

Browse files
committed
fix unittest errors
1 parent 06a49f4 commit ad986d1

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

source/module_cell/module_neighbor/sltk_atom.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,3 @@ FAtom::FAtom()
1515
type = 0;
1616
natom = 0;
1717
}
18-
19-
FAtom::~FAtom()
20-
{
21-
}

source/module_cell/module_neighbor/sltk_atom.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ class FAtom
4343
cell_y = cell_y_in;
4444
cell_z = cell_z_in;
4545
}
46-
~FAtom();
46+
~FAtom()
47+
{
48+
adjacent.clear();
49+
}
4750

4851
void addAdjacent(FAtom& atom_in)
4952
{

source/module_cell/module_neighbor/test/sltk_adjacent_set_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ TEST_F(SltkAdjacentSetTest, SetWithoutExpand)
6262
EXPECT_EQ(box_y, 1);
6363
EXPECT_EQ(box_z, -1);
6464
// delete_vector
65-
test.delete_vector();
65+
/*test.delete_vector();
6666
EXPECT_EQ(test.box.size(),0);
67-
EXPECT_EQ(test.offset.size(), 0);
67+
EXPECT_EQ(test.offset.size(), 0);*/
6868
}
6969

7070
TEST_F(SltkAdjacentSetTest, SetWithExpand)
@@ -109,7 +109,7 @@ TEST_F(SltkAdjacentSetTest, SetWithExpand)
109109
EXPECT_EQ(box_y, 0);
110110
EXPECT_EQ(box_z, 0);
111111
// delete_vector
112-
test.delete_vector();
112+
/*test.delete_vector();
113113
EXPECT_EQ(test.box.size(), 0);
114-
EXPECT_EQ(test.offset.size(), 0);
114+
EXPECT_EQ(test.offset.size(), 0);*/
115115
}

source/module_cell/module_neighbor/test/sltk_atom_test.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,10 @@ class SltkAtomTest : public testing::Test
2929

3030
TEST_F(SltkAtomTest, AllocateAdjacentSet)
3131
{
32-
test.allocate_AdjacentSet();
33-
std::shared_ptr<AdjacentSet> a = test.getAdjacentSet();
34-
int x = 1;
35-
int y = 1;
36-
int z = 1;
37-
int offset = 1;
38-
int test_grid_in = 1;
39-
a->set(x, y, z, offset, test_grid_in);
40-
EXPECT_EQ(a->box[0], 26);
41-
42-
test.delete_vector();
43-
std::shared_ptr<AdjacentSet> b = test.getAdjacentSet();
44-
EXPECT_EQ(b->box.size(), 0);
32+
test.clearAdjacent();
33+
FAtom test_temp(1.0, 2.0, 3.0, 4, 5, 0, 1, 2);
34+
test.addAdjacent(test_temp);
35+
EXPECT_EQ(test.getAdjacent().front()->getType(), 4);
4536
}
4637

4738

0 commit comments

Comments
 (0)