1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include <gtest/gtest.h>
- #include "modules/Elliptic_integrals.cpp"
- #include <cmath>
- class Elliptic_IntegralsTest : public testing::Test{};
- TEST_F(Elliptic_IntegralsTest, Elliptic_0_0)
- {
- std::vector<double> res = 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)
- {
- std::vector<double> res = 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)
- {
- std::vector<double> res = 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)
- {
- std::vector<double> res = Elliptic(90, 1);
- EXPECT_DOUBLE_EQ(res[0], std::numeric_limits<double>::infinity()) << "F(90, 1)";
- EXPECT_DOUBLE_EQ(res[1], 1)<< "E(90, 1)";
- }
- TEST_F(Elliptic_IntegralsTest, Elliptic_Throw)
- {
- std::vector<double> result = 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();
- }
|