// tests/test_airframe.cpp #include "vendor/catch_amalgamated.hpp" #include "Airframe.h" // Bring Approx into scope using Catch::Approx; TEST_CASE("Airframe basic behavior", "[airframe]") { Airframe airframe( "TestBody", 1.5, // length meters 0.1, // diameter meters 2.0, // dry mass kg 0.75 // drag coefficient (unitless) ); SECTION("Airframe properties are correctly initialized") { REQUIRE(airframe.getLength() == Approx(1.5)); REQUIRE(airframe.getDiameter() == Approx(0.1)); REQUIRE(airframe.getDryMass() == Approx(2.0)); REQUIRE(airframe.getDragCoefficient() == Approx(0.75)); REQUIRE(airframe.getName() == "TestBody"); } SECTION("Reference area calculation is correct") { double expectedArea = 3.14159265358979323846 * (0.1/2.0) * (0.1/2.0); REQUIRE(airframe.getReferenceArea() == Approx(expectedArea).epsilon(0.001)); } }