-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_Cl1.cpp
31 lines (26 loc) · 1.18 KB
/
test_Cl1.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 1
#include "doctest.h"
#include "Cl1.hpp"
#include "read_data.hpp"
#include "test.hpp"
#include <cmath>
TEST_CASE("test_real_fixed_values")
{
const auto eps64 = std::pow(10.0 , -std::numeric_limits<double>::digits10);
const std::string filename(std::string(TEST_DATA_DIR) + PATH_SEPARATOR + "Cl1.txt");
const auto fixed_values = polylogarithm::test::read_reals_from_file<long double>(filename);
for (auto v: fixed_values) {
const auto x128 = v.first;
const auto x64 = static_cast<double>(x128);
const auto cl128_expected = v.second;
const auto cl64_expected = static_cast<double>(cl128_expected);
const auto cl64_poly = polylogarithm::Cl1(x64);
INFO("x(64) = " << x64);
INFO("Cl1(64) real = " << cl64_expected << " (expected)");
INFO("Cl1(64) real = " << cl64_poly << " (polylogarithm C++)");
CHECK_CLOSE(cl64_poly, cl64_expected, 4*eps64);
CHECK_CLOSE(polylogarithm::Cl1(-x64), cl64_expected, 4*eps64);
CHECK_CLOSE(polylogarithm::Cl1(x64 + 2*M_PI), cl64_expected, 10*eps64);
CHECK_CLOSE(polylogarithm::Cl1(x64 - 2*M_PI), cl64_expected, 10*eps64);
}
}