* Spline.cpp - Unit test for spline class
*
* Copyright (C) 2017 Guilherme Brondani Torri <guitorri@gmail.com>
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this package; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include <iostream>
#include "qucs_typedefs.h"
#include "real.h"
#include "poly.h"
#include "spline.h"
#include "gtest/gtest.h"
TEST(spline, issue676) {
qucs::spline *rsp = new qucs::spline (qucs::SPLINE_BC_PERIODIC);
int length = 3;
nr_double_t * rx = new nr_double_t[length];
nr_double_t * ry = new nr_double_t[length];
rx[0] = 0.0;
rx[1] = 1.0;
rx[2] = 2.0;
ry[0] = 0.0;
ry[1] = 10.0;
ry[2] = 20.0;
rsp->vectors (ry, rx, length);
rsp->construct ();
nr_double_t x = 1.01;
nr_double_t f0 = rsp->evaluate(x).f0;
EXPECT_NEAR (f0, 10.1, 0.01);
rsp->qucs::spline::~spline();
}