@ -4,34 +4,6 @@
# include "../src/config_loader.h"
# include <cmath>
TEST_CASE ( " Invalid parent: Earth should not become child of spacecraft " ,
" [init][parent][bug] " ) {
const double TIME_STEP = 60.0 ;
SimulationState * sim = create_simulation ( 10 , 0 , 0 , TIME_STEP ) ;
REQUIRE ( load_system_config ( sim , " tests/configs/earth_mars_simple.toml " ) ) ;
const int EARTH_IDX = 1 ;
const int SPACECRAFT_IDX = 3 ;
const int SUN_IDX = 0 ;
REQUIRE ( sim - > bodies [ EARTH_IDX ] . parent_index = = SUN_IDX ) ;
for ( int step = 0 ; step < 10 ; step + + ) {
update_simulation ( sim ) ;
int earth_parent = sim - > bodies [ EARTH_IDX ] . parent_index ;
INFO ( " Step " < < step < < " : Earth's parent = " < < earth_parent
< < " ( " < < ( earth_parent = = SPACECRAFT_IDX ? " SPACECRAFT " :
earth_parent = = SUN_IDX ? " Sun " : " Other " ) < < " ) " ) ;
REQUIRE ( earth_parent ! = SPACECRAFT_IDX ) ;
}
destroy_simulation ( sim ) ;
}
TEST_CASE ( " Invalid parent: massive bodies never become children of small bodies " ,
" [init][parent][hierarchy] " ) {
const double TIME_STEP = 60.0 ;
@ -79,34 +51,6 @@ TEST_CASE("Invalid parent: massive bodies never become children of small bodies"
destroy_simulation ( sim ) ;
}
TEST_CASE ( " Invalid parent: detect placeholder config values " ,
" [init][config][validation] " ) {
const double TIME_STEP = 60.0 ;
SimulationState * sim = create_simulation ( 10 , 0 , 0 , TIME_STEP ) ;
REQUIRE ( load_system_config ( sim , " tests/configs/earth_mars_simple.toml " ) ) ;
const int EARTH_IDX = 1 ;
const int SPACECRAFT_IDX = 3 ;
Vec3 craft_pos = sim - > bodies [ SPACECRAFT_IDX ] . global_position ;
Vec3 earth_pos = sim - > bodies [ EARTH_IDX ] . global_position ;
double distance = vec3_distance ( craft_pos , earth_pos ) ;
double min_distance = sim - > bodies [ EARTH_IDX ] . radius + sim - > bodies [ SPACECRAFT_IDX ] . radius ;
INFO ( " Distance Earth <-> Spacecraft: " < < distance < < " m " ) ;
INFO ( " Earth position: ( " < < earth_pos . x < < " , " < < earth_pos . y < < " , " < < earth_pos . z < < " ) " ) ;
INFO ( " Spacecraft position: ( " < < craft_pos . x < < " , " < < craft_pos . y < < " , " < < craft_pos . z < < " ) " ) ;
INFO ( " Earth radius: " < < sim - > bodies [ EARTH_IDX ] . radius < < " m " ) ;
INFO ( " Spacecraft radius: " < < sim - > bodies [ SPACECRAFT_IDX ] . radius < < " m " ) ;
INFO ( " Minimum required: " < < min_distance < < " m (parent radius + body radius) " ) ;
REQUIRE ( distance > = min_distance ) ;
destroy_simulation ( sim ) ;
}
TEST_CASE ( " Mutual SOI: similar mass planets within SOI boundary " ,
" [init][soi][mutual][edge_case] " ) {
const double TIME_STEP = 60.0 ;