Skip to content

Commit ea17559

Browse files
committed
add a unit test
1 parent 156ee88 commit ea17559

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

source/module_base/test/vector3_test.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
* - VneV
6565
* - overload operator "!=" to assert
6666
* - the inequality between two 3d vectors
67+
* - VltV
68+
* - overload operator "<" to sort
69+
* - the "less than" relationship between two 3d vectors
6770
* - StdOutV
6871
* - overload operator "<<" to print out
6972
* - a 3d vectors on standard output
@@ -703,6 +706,22 @@ TEST_F(Vector3Test,VneV)
703706
EXPECT_TRUE(wp != w);
704707
}
705708

709+
TEST_F(Vector3Test, VltV)
710+
{
711+
ModuleBase::Vector3<double> u, up;
712+
u.set(da, db, dc);
713+
up.set(dc, db, da);
714+
EXPECT_TRUE(u < up);
715+
ModuleBase::Vector3<float> v, vp;
716+
v.set(fa, fb, fc);
717+
vp.set(fa, fb, fc);
718+
EXPECT_FALSE(v < vp);
719+
ModuleBase::Vector3<int> w, wp;
720+
w.set(ia, ib, ic);
721+
wp.set(ib, ib, ic);
722+
EXPECT_TRUE(w < wp);
723+
}
724+
706725
TEST_F(Vector3Test,StdOutV)
707726
{
708727
// double Vector3

0 commit comments

Comments
 (0)