From 83c17274ae1c9f8c10ee4210fd28fae114f94d40 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Fri, 13 Dec 2024 14:38:13 +0100 Subject: [PATCH 1/5] attempt to identify randomly failed vehicle_turret_test cause --- tests/vehicle_turrets_test.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/vehicle_turrets_test.cpp b/tests/vehicle_turrets_test.cpp index d9133efe8cf87..9f4a18ab958fa 100644 --- a/tests/vehicle_turrets_test.cpp +++ b/tests/vehicle_turrets_test.cpp @@ -45,10 +45,18 @@ TEST_CASE( "vehicle_turret", "[vehicle][gun][magazine]" ) clear_avatar(); map &here = get_map(); Character &player_character = get_player_character(); + static const vproto_id vehicle_prototype_test_turret_rig( "test_turret_rig" ); + const tripoint_bub_ms veh_pos( 65, 65, here.get_abs_sub().z() ); + // TODO: Get rid of this set of tests when the cause of this test randomly failing has been elimined. + REQUIRE( veh_pos.z() == 0 ); + REQUIRE( vehicle_prototype_test_turret_rig.is_valid() ); + REQUIRE( here.inbounds( veh_pos ) ); + // TODO: End + for( const vpart_info *turret_vpi : all_turret_types() ) { SECTION( turret_vpi->name() ) { - vehicle *veh = here.add_vehicle( STATIC( vproto_id( "test_turret_rig" ) ), - tripoint_bub_ms( 65, 65, here.get_abs_sub().z() ), 270_degrees, 0, 0, false ); + vehicle *veh = here.add_vehicle( vehicle_prototype_test_turret_rig, veh_pos, 270_degrees, 0, 0, + false ); REQUIRE( veh ); veh->unlock(); From 5643ae50cca95671282e3e98bd837da5ba655085 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Fri, 13 Dec 2024 14:56:19 +0100 Subject: [PATCH 2/5] demanded change --- tests/vehicle_turrets_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/vehicle_turrets_test.cpp b/tests/vehicle_turrets_test.cpp index 9f4a18ab958fa..7a8a0f51e949d 100644 --- a/tests/vehicle_turrets_test.cpp +++ b/tests/vehicle_turrets_test.cpp @@ -39,13 +39,14 @@ static std::vector all_turret_types() } // Install, reload and fire every possible vehicle turret. +static const vproto_id vehicle_prototype_test_turret_rig( "test_turret_rig" ); + TEST_CASE( "vehicle_turret", "[vehicle][gun][magazine]" ) { clear_map(); clear_avatar(); map &here = get_map(); Character &player_character = get_player_character(); - static const vproto_id vehicle_prototype_test_turret_rig( "test_turret_rig" ); const tripoint_bub_ms veh_pos( 65, 65, here.get_abs_sub().z() ); // TODO: Get rid of this set of tests when the cause of this test randomly failing has been elimined. REQUIRE( veh_pos.z() == 0 ); From 515375312b835442ba83f32d9ed505659b2ad9cb Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Fri, 13 Dec 2024 15:05:17 +0100 Subject: [PATCH 3/5] demanded change --- tests/vehicle_turrets_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/vehicle_turrets_test.cpp b/tests/vehicle_turrets_test.cpp index 7a8a0f51e949d..ba28ad0cc195a 100644 --- a/tests/vehicle_turrets_test.cpp +++ b/tests/vehicle_turrets_test.cpp @@ -25,6 +25,8 @@ static const ammo_effect_str_id ammo_effect_RECYCLED( "RECYCLED" ); +static const vproto_id vehicle_prototype_test_turret_rig("test_turret_rig"); + static std::vector all_turret_types() { std::vector res; @@ -39,8 +41,6 @@ static std::vector all_turret_types() } // Install, reload and fire every possible vehicle turret. -static const vproto_id vehicle_prototype_test_turret_rig( "test_turret_rig" ); - TEST_CASE( "vehicle_turret", "[vehicle][gun][magazine]" ) { clear_map(); From a76d2f304d11e50e575cf2063ea7b0afebeb4d1f Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Fri, 13 Dec 2024 15:05:37 +0100 Subject: [PATCH 4/5] demanded change --- tests/vehicle_turrets_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/vehicle_turrets_test.cpp b/tests/vehicle_turrets_test.cpp index ba28ad0cc195a..1718a8353abf2 100644 --- a/tests/vehicle_turrets_test.cpp +++ b/tests/vehicle_turrets_test.cpp @@ -25,7 +25,7 @@ static const ammo_effect_str_id ammo_effect_RECYCLED( "RECYCLED" ); -static const vproto_id vehicle_prototype_test_turret_rig("test_turret_rig"); +static const vproto_id vehicle_prototype_test_turret_rig( "test_turret_rig" ); static std::vector all_turret_types() { From b7cbd1629dfc45a0ed5829bc269cceb9a5384f9b Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Fri, 13 Dec 2024 15:36:03 +0100 Subject: [PATCH 5/5] Update tests/vehicle_turrets_test.cpp Co-authored-by: Anton Burmistrov --- tests/vehicle_turrets_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/vehicle_turrets_test.cpp b/tests/vehicle_turrets_test.cpp index 1718a8353abf2..3339b25d944f3 100644 --- a/tests/vehicle_turrets_test.cpp +++ b/tests/vehicle_turrets_test.cpp @@ -48,7 +48,7 @@ TEST_CASE( "vehicle_turret", "[vehicle][gun][magazine]" ) map &here = get_map(); Character &player_character = get_player_character(); const tripoint_bub_ms veh_pos( 65, 65, here.get_abs_sub().z() ); - // TODO: Get rid of this set of tests when the cause of this test randomly failing has been elimined. + // TODO: Get rid of this set of tests when the cause of this test randomly failing has been eliminated. REQUIRE( veh_pos.z() == 0 ); REQUIRE( vehicle_prototype_test_turret_rig.is_valid() ); REQUIRE( here.inbounds( veh_pos ) );