Refactor mean and mean_pair test case.

release/4.3a0
alexma3312 2020-09-08 22:45:32 -04:00
parent a1b73b3776
commit 41921c3173
1 changed files with 3 additions and 9 deletions

View File

@ -166,14 +166,11 @@ TEST (Point3, normalize) {
//*************************************************************************
TEST(Point3, mean) {
Point3 expected_a_mean(2, 2, 2), expected_b_mean(-1, 1, 0);
Point3 expected_a_mean(2, 2, 2);
Point3 a1(0, 0, 0), a2(1, 2, 3), a3(5, 4, 3);
Point3 b1(-1, 0, 0), b2(-2, 4, 0), b3(0, -1, 0);
std::vector<Point3> a_points{a1, a2, a3}, b_points{b1, b2, b3};
std::vector<Point3> a_points{a1, a2, a3};
Point3 actual_a_mean = mean(a_points);
Point3 actual_b_mean = mean(b_points);
EXPECT(assert_equal(expected_a_mean, actual_a_mean));
EXPECT(assert_equal(expected_b_mean, actual_b_mean));
}
TEST(Point3, mean_pair) {
@ -181,10 +178,7 @@ TEST(Point3, mean_pair) {
Point3Pair expected_mean = std::make_pair(a_mean, b_mean);
Point3 a1(0, 0, 0), a2(1, 2, 3), a3(5, 4, 3);
Point3 b1(-1, 0, 0), b2(-2, 4, 0), b3(0, -1, 0);
Point3Pair ab1(std::make_pair(a1, b1));
Point3Pair ab2(std::make_pair(a2, b2));
Point3Pair ab3(std::make_pair(a3, b3));
std::vector<Point3Pair> point_pairs{ab1, ab2, ab3};
std::vector<Point3Pair> point_pairs{{a1,b1},{a2,b2},{a3,b3}};
Point3Pair actual_mean = mean(point_pairs);
EXPECT(assert_equal(expected_mean.first, actual_mean.first));
EXPECT(assert_equal(expected_mean.second, actual_mean.second));