39#include <gtest/gtest.h>
57double sin_func(
double x,
void* ) {
return std::sin(x); }
60double exp_func(
double x,
void* ) {
return std::exp(x); }
74 EXPECT_NEAR(result, 0.5, 1e-6);
91 EXPECT_NEAR(result, 8.0 / 3.0, 1e-6);
103 double result, error;
107 EXPECT_EQ(status, 0);
108 EXPECT_NEAR(result, 2.0, 1e-6);
120 double result, error;
124 EXPECT_EQ(status, 0);
125 EXPECT_NEAR(result, std::exp(1.0) - 1.0, 1e-6);
137 double result, error;
141 EXPECT_EQ(status, 0);
142 EXPECT_NEAR(result, 0.0, 1e-6);
154 double result, error;
158 EXPECT_EQ(status, 0);
159 EXPECT_NEAR(result, 0.1 * 0.1 * 0.1 / 3.0, 1e-6);
gsl_integration_workspace * gsl_integration_workspace_alloc(size_t n)
Allocate integration workspace with limit .
int gsl_integration_qag(const gsl_function *f, double a, double b, double epsabs, double epsrel, size_t, int, gsl_integration_workspace *, double *result, double *abserr)
Adaptive integration on using Simpson refinement.
constexpr int GSL_INTEG_GAUSS15
Integration rule identifiers (accepted but not used in this implementation).
void gsl_integration_workspace_free(gsl_integration_workspace *w)
Free a workspace allocated by gsl_integration_workspace_alloc.
double linear_func(double x, void *)
double sin_func(double x, void *)
double exp_func(double x, void *)
TEST_F(GSLIntegrationTest, LinearFunction)
double quadratic_func(double x, void *)
Function wrapper used by integration routines.
double(* function)(double x, void *params)
Workspace for adaptive integration routines.