Skip to content

Commit

Permalink
Test: UnitTest for ZEROS (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeptemberMy committed Jan 13, 2023
1 parent 86bd28b commit 4c47247
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/module_base/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ AddTest(
TARGET base_opt_TN
SOURCES opt_TN_test.cpp opt_test_tools.cpp ../opt_CG.cpp ../opt_DCsrch.cpp ../global_variable.cpp ../../src_parallel/parallel_reduce.cpp
)

AddTest(
TARGET base_ylm
SOURCES ylm_test.cpp ../ylm.cpp ../timer.cpp ../tool_quit.cpp ../global_variable.cpp ../global_file.cpp ../memory.cpp
)
25 changes: 25 additions & 0 deletions source/module_base/test/ylm_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "../ylm.h"
#include "gtest/gtest.h"
/************************************************
* unit test of class ylm
***********************************************/

/**
* - Tested Functions:
* - ZEROS
* - set all elements of a double float array to zero
* */

class ylmTest : public testing::Test
{
};

TEST_F(ylmTest,Zeros)
{
double aaaa[100];
ModuleBase::Ylm::ZEROS(aaaa,100);
for(int i = 0; i < 100; i++)
{
EXPECT_EQ(aaaa[i],0.0);
}
}

0 comments on commit 4c47247

Please sign in to comment.