qtrocket2/tests/test_finset.cpp
2025-04-20 12:29:36 -06:00

45 lines
1.1 KiB
C++
Executable File

// tests/test_finset.cpp
#include "vendor/catch_amalgamated.hpp"
#include "FinSet.h"
// Bring Approx into scope
using Catch::Approx;
TEST_CASE("FinSet basic behavior", "[finset]") {
FinSet finSet(
"TestFins",
3, // Number of fins
0.15, // Root chord (m)
0.10, // Tip chord (m)
0.10, // Span (m)
0.05, // Sweep length (m)
0.003, // Thickness (m)
500.0 // Material density (kg/m3)
);
SECTION("FinSet properties are initialized correctly") {
REQUIRE(finSet.getName() == "TestFins");
}
SECTION("Normal force coefficient is positive") {
double Cn = finSet.calculateNormalForceCoefficient();
REQUIRE(Cn > 0.0);
}
SECTION("Center of pressure is reasonable") {
double cp = finSet.calculateCenterOfPressure();
REQUIRE(cp > 0.0);
}
SECTION("Drag area calculation is reasonable") {
double dragArea = finSet.calculateDragArea();
REQUIRE(dragArea > 0.0);
}
SECTION("Mass calculation is reasonable") {
double mass = finSet.calculateMass();
REQUIRE(mass > 0.0);
}
}