spline_test.cpp
Go to the documentation of this file.
1 //=============================================================================
2 // Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3 // Author: Gonzalo Mier
4 // BSD-3 License
5 //=============================================================================
6 
7 #include <gtest/gtest.h>
9 
10 TEST(fields2cover_utils_spline, init) {
11  std::vector<double> x {1, 2, 4, 5};
12  std::vector<double> y1 {1, 2, 4, 5};
13  std::vector<double> y2 {-10, -20, -40, -50};
14  std::vector<double> y3 {0, 1, 1, 0};
15 
16  f2c::CubicSpline cs1(x, y1);
17  EXPECT_NEAR(cs1(3), 3.0, 1e-3);
18 
19  f2c::CubicSpline cs2(x, y2);
20  EXPECT_NEAR(cs2(3), -30.0, 1e-3);
21 
22  f2c::CubicSpline cs3(x, y3);
23  EXPECT_GT(cs3(3), 1.0);
24  EXPECT_LT(cs3(3), 2.0);
25  EXPECT_NEAR(cs3(1.5), cs3(1.5), 1e-3);
26 }
27 
28 
spline.h
TEST
TEST(fields2cover_utils_spline, init)
Definition: spline_test.cpp:10
f2c::CubicSpline
Definition: spline.h:44


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31