#include #include "modules/Elliptic_integrals.cpp" #include class Elliptic_IntegralsTest : public testing::Test { protected: Elliptic_IntegralsTest() { } ~Elliptic_IntegralsTest() override { } void SetUp() override { } void TearDown() override { } }; TEST_F(Elliptic_IntegralsTest, Elliptic_0_0) { Elliptic_Integrals ElInt; std::vector res = ElInt.Elliptic(0, 0); EXPECT_DOUBLE_EQ(res[0], 0) << "F(0, 0)"; EXPECT_DOUBLE_EQ(res[1], 0) << "E(0, 0)"; } TEST_F(Elliptic_IntegralsTest, Elliptic_90_0) { Elliptic_Integrals ElInt; std::vector res = ElInt.Elliptic(90, 0); EXPECT_DOUBLE_EQ(res[0], M_PI / 2) << "F(90, 0)"; EXPECT_DOUBLE_EQ(res[1], M_PI / 2)<< "E(90, 0)"; } TEST_F(Elliptic_IntegralsTest, Elliptic_0_1) { Elliptic_Integrals ElInt; std::vector res = ElInt.Elliptic(0, 1); EXPECT_DOUBLE_EQ(res[0], 0) << "F(0, 1)"; EXPECT_DOUBLE_EQ(res[1], 0) << "E(0, 1)"; } TEST_F(Elliptic_IntegralsTest, Elliptic_90_1) { Elliptic_Integrals ElInt; std::vector res = ElInt.Elliptic(90, 1); EXPECT_DOUBLE_EQ(res[0], std::numeric_limits::infinity()) << "F(90, 1)"; EXPECT_DOUBLE_EQ(res[1], 1)<< "E(90, 1)"; } TEST_F(Elliptic_IntegralsTest, Elliptic_Throw) { Elliptic_Integrals ellIntegrals; std::vector result = ellIntegrals.Elliptic(50, 2); EXPECT_EQ(result.size(), 0); // if k > 1 or k < - 1 vector of Elliptic(phi, k) should be empty } int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }