12 #include <gtest/gtest.h> 18 const double test_values[][2] = {{0.0, .0},
19 {0.79788456080286541, 0.721705924292605},
20 {1.0, 0.779893400376823},
21 {0.4, 0.397480759172359},
22 {1.5, 0.445261176039822},
23 {2.0, 0.488253406075341},
24 {2.4, 0.554961405856428},
25 {3.34, 0.407099627096608},
26 {50.0, 0.499999189430728},
27 {-0.4, -0.397480759172359},
28 {-1.5, -0.445261176039822},
29 {-2.0, -0.488253406075341},
30 {-2.4, -0.554961405856428},
31 {-3.34, -0.407099627096608},
32 {-50.0, -0.499999189430728}};
34 const unsigned int nTests =
sizeof(test_values) /
sizeof(test_values[0]);
36 for (
unsigned int i = 0; i < nTests; i++)
38 const double x = test_values[i][0], val_good = test_values[i][1];
40 EXPECT_NEAR(
val, val_good, 1e-5)
41 <<
" x: " <<
x <<
"\n val_good: " << val_good <<
"\n val: " <<
val 49 const double test_values[][2] = {{0.0, .0},
50 {1.0, 0.438259147390355},
51 {1.5, 0.697504960082093},
52 {2.4, 0.619689964945684},
53 {50.0, 0.493633802585939},
54 {-2.0, -0.343415678363698},
55 {-2.4, -0.619689964945684},
56 {-3.34, -0.479600423968308},
57 {-50.0, -0.493633802585939}};
59 const unsigned int nTests =
sizeof(test_values) /
sizeof(test_values[0]);
61 for (
unsigned int i = 0; i < nTests; i++)
63 const double x = test_values[i][0], val_good = test_values[i][1];
65 EXPECT_NEAR(
val, val_good, 1e-5)
66 <<
" x: " <<
x <<
"\n val_good: " << val_good <<
"\n val: " <<
val double fresnel_cos_integral(double x) noexcept
Evaluates the integral from 0 to x of sqrt(2/pi) cos(t^2) dt.
double fresnel_sin_integral(double x) noexcept
Evaluates the integral from 0 to x of sqrt(2/pi) sin(t^2) dt.