Files
ConformalLabpp/code/tests/test_clausen.cpp
Tarik Moussa c30d540521 add GTest infrastructure and port first mathematical tests from Java
- Add Google Test via CMake FetchContent (v1.14.0)
- Add clausen.hpp: Clausen integral, Lobachevsky function, Im(Li2)
- Add hyper_ideal_utility.hpp: generalized and ideal-vertex hyperbolic
  tetrahedron volume formulas using Eigen for the 4x4 Gram determinant
- Port ClausenTest (5 tests) and HyperIdealUtilityTest (8 tests) from
  Java/JUnit — all 13 pass with same tolerances as the Java originals
- Fix pre-existing VIEWER/viewer case mismatch in CMakeLists.txt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 01:07:19 +02:00

36 lines
902 B
C++

// Port of de.varylab.discreteconformal.functional.ClausenTest (Java/JUnit).
// Reference values computed with Mathematica.
#include "clausen.hpp"
#include <gtest/gtest.h>
#include <complex>
using conformallab::ImLi2;
using C = std::complex<double>;
TEST(ClausenTest, ImLi2_case1) {
double r = ImLi2(C(0.5, 0.5));
EXPECT_NEAR(0.643767332889268748742017, r, 1e-15);
}
TEST(ClausenTest, ImLi2_case2) {
double r = ImLi2(C(1.234, -3.554));
EXPECT_NEAR(-2.784709023190200241929031, r, 1e-15);
}
TEST(ClausenTest, ImLi2_case3) {
double r = ImLi2(C(-4.254, 2.965));
EXPECT_NEAR(1.104092479314665907914598, r, 1e-15);
}
TEST(ClausenTest, ImLi2_case4) {
double r = ImLi2(C(-2.264, -1.05));
EXPECT_NEAR(-0.540683148040955780529547, r, 1e-15);
}
TEST(ClausenTest, ImLi2_case5) {
double r = ImLi2(C(-4.0, 2.0));
EXPECT_NEAR(0.7855694340809751306351005, r, 1e-15);
}