Skip to content

Commit 3623fc2

Browse files
committed
test(spline): Simplified and reduced redundancy
1 parent bfda096 commit 3623fc2

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

tests/spline/test_cubic.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ TEST(CubicSplineTest, General) {
4141
const std::vector<double> X = {0, 1, 2, 3};
4242
const std::vector<double> Y = {5, 2, 10, 4};
4343
const auto spline = alfi::spline::CubicSpline(X, Y);
44-
for (size_t i = 0; i < X.size() - 1; ++i) {
44+
for (size_t i = 0; i < X.size(); ++i) {
4545
EXPECT_EQ(spline(X[i]), Y[i]);
46-
EXPECT_EQ(spline(X[i+1]), Y[i+1]);
4746
}
4847
}
4948

tests/spline/test_linear.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ TEST(LinearSplineTest, General) {
3636
// exact points
3737
EXPECT_EQ(spline(X[i]), Y[i]);
3838
EXPECT_EQ(spline(X[i+1]), Y[i+1]);
39-
EXPECT_EQ(spline(X[i]), Y[i]);
40-
EXPECT_EQ(spline(X[i+1]), Y[i+1]);
4139
// between points
4240
EXPECT_DOUBLE_EQ(spline(X[i] + epsilon), Y[i] + epsilon * (Y[i+1] - Y[i]));
4341
EXPECT_DOUBLE_EQ(spline((X[i]+X[i+1])/2), (Y[i] + Y[i+1])/2);

tests/spline/test_quadratic.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ TEST(QuadraticSplineTest, General) {
4343
const std::vector<double> X = {0, 1, 2, 3};
4444
const std::vector<double> Y = {5, 2, 10, 4};
4545
const auto spline = alfi::spline::QuadraticSpline(X, Y);
46-
for (size_t i = 0; i < X.size() - 1; ++i) {
46+
for (size_t i = 0; i < X.size(); ++i) {
4747
EXPECT_EQ(spline(X[i]), Y[i]);
48-
EXPECT_EQ(spline(X[i+1]), Y[i+1]);
4948
}
5049
}
5150

0 commit comments

Comments
 (0)