#include <catch2/catch.hpp>
#include "Data/Rod2dMulti.hpp"
#include "Force/ForceMulti.h"

TEST_CASE("Forces") {
    ForceMulti force(100);
    Rod2dMulti rod(1, 100);
    Simulation sim(1, 123);
    sim.set_xBorder(100);
    Eigen::Vector2d zero_pos{0.0, 0.0};
    Eigen::Vector2d one_pos{1.0, 0.0};
    Eigen::Vector2d per_zero_pos{100, 100};
    SECTION("Basic Force") {
        auto F00 = force.force(zero_pos, zero_pos, sim);
        auto F11 = force.force(one_pos, one_pos, sim);

        auto F01 = force.force(zero_pos, one_pos, sim);
        auto F10 = force.force(one_pos, zero_pos, sim);

        CHECK(F11 == F00);
        CHECK(F01 == -F10);
    }
    SECTION("Basic Torque") {}
    SECTION("Peridoic Torque") {}
    SECTION("Complete Calculation") {
        force.force_torque(rod, sim);
        const auto F = force.get_force();
        auto F0 = F[0];
        for (const auto &f : F) {
            CHECK(F0 == f);
        }
        const auto T = force.get_torque();
        auto T0 = T[0];
        for (const auto &f : T) {
            CHECK(T0 == f);
        }
    }
}
