Skip to content

Commit 4c47247

Browse files
authored
Test: UnitTest for ZEROS (#1798)
1 parent 86bd28b commit 4c47247

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

source/module_base/test/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,8 @@ AddTest(
127127
TARGET base_opt_TN
128128
SOURCES opt_TN_test.cpp opt_test_tools.cpp ../opt_CG.cpp ../opt_DCsrch.cpp ../global_variable.cpp ../../src_parallel/parallel_reduce.cpp
129129
)
130+
131+
AddTest(
132+
TARGET base_ylm
133+
SOURCES ylm_test.cpp ../ylm.cpp ../timer.cpp ../tool_quit.cpp ../global_variable.cpp ../global_file.cpp ../memory.cpp
134+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include "../ylm.h"
2+
#include "gtest/gtest.h"
3+
/************************************************
4+
* unit test of class ylm
5+
***********************************************/
6+
7+
/**
8+
* - Tested Functions:
9+
* - ZEROS
10+
* - set all elements of a double float array to zero
11+
* */
12+
13+
class ylmTest : public testing::Test
14+
{
15+
};
16+
17+
TEST_F(ylmTest,Zeros)
18+
{
19+
double aaaa[100];
20+
ModuleBase::Ylm::ZEROS(aaaa,100);
21+
for(int i = 0; i < 100; i++)
22+
{
23+
EXPECT_EQ(aaaa[i],0.0);
24+
}
25+
}

0 commit comments

Comments
 (0)