Skip to content

Commit e5ee79a

Browse files
authored
Test: UnitTest for overloading of operator "()" (#1917)
1 parent 889c499 commit e5ee79a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

source/module_base/test/complexarray_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
* - function point_mult()
7272
* - function complexArrayxAlloc
7373
* - overloading of the function scaled_sum(). Does cd3 = c1*cd1 + c2*cd2. c1 and c2 are complex numbers.
74+
* - overloading of operator "()". The operator is effectively overload by "const".
7475
*/
7576

7677
//compare two complex by using EXPECT_DOUBLE_EQ()
@@ -501,3 +502,10 @@ TEST_F(ComplexArray_test,scaled_sum_2)
501502
EXPECT_COMPLEX_EQUAL(c2.ptr[i],com3*com1 + com3*com2);
502503
}
503504
}
505+
506+
TEST_F(ComplexArray_test,operator_parentheses_const)
507+
{
508+
a2=com1;
509+
const ModuleBase::ComplexArray ca2=a2;
510+
EXPECT_COMPLEX_EQUAL(ca2(0,0,0,0), com1);
511+
}

0 commit comments

Comments
 (0)