From e2dd001b45e108e7091ecf45565c4cd269713329 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Mon, 13 Jan 2025 10:43:46 +0100 Subject: [PATCH 1/2] Don't try to GENERATE typed coordinates --- tests/map_test.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/map_test.cpp b/tests/map_test.cpp index 299f24d806286..944a7afa94451 100644 --- a/tests/map_test.cpp +++ b/tests/map_test.cpp @@ -29,10 +29,10 @@ TEST_CASE( "map_coordinate_conversion_functions" ) here.vertical_shift( 0 ); } ); - tripoint_bub_ms test_point = - GENERATE( tripoint_bub_ms::zero, tripoint_bub_ms::zero + tripoint::south, - tripoint_bub_ms::zero + tripoint::east, tripoint_bub_ms::zero + tripoint::above, - tripoint_bub_ms::zero + tripoint::below ); + tripoint test_point = + GENERATE( tripoint::zero, tripoint::south, + tripoint::east, tripoint::above, + tripoint::below ); tripoint_bub_ms test_bub( test_point ); int z = GENERATE( 0, 1, -1, OVERMAP_HEIGHT, -OVERMAP_DEPTH ); @@ -53,7 +53,7 @@ TEST_CASE( "map_coordinate_conversion_functions" ) point_abs_ms map_origin_ms = project_to( here.get_abs_sub().xy() ); - tripoint_abs_ms test_abs = map_origin_ms + rebase_rel( test_point ); + tripoint_abs_ms test_abs = map_origin_ms + rebase_rel( test_bub ); if( test_abs.z() > OVERMAP_HEIGHT || test_abs.z() < -OVERMAP_DEPTH ) { return; @@ -64,7 +64,7 @@ TEST_CASE( "map_coordinate_conversion_functions" ) // Verify round-tripping CHECK( here.getglobal( here.bub_from_abs( test_abs ) ) == test_abs ); - CHECK( here.bub_from_abs( here.getglobal( test_point ) ) == test_point ); + CHECK( here.bub_from_abs( here.getglobal( test_bub ) ) == test_bub ); } TEST_CASE( "destroy_grabbed_furniture" ) From d1ffc5469be8003736f636bfc3d38fe417025ab6 Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Mon, 13 Jan 2025 14:00:30 +0100 Subject: [PATCH 2/2] Adjusted according to comments --- tests/map_test.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/map_test.cpp b/tests/map_test.cpp index 944a7afa94451..5b788e5ef282e 100644 --- a/tests/map_test.cpp +++ b/tests/map_test.cpp @@ -29,11 +29,10 @@ TEST_CASE( "map_coordinate_conversion_functions" ) here.vertical_shift( 0 ); } ); - tripoint test_point = - GENERATE( tripoint::zero, tripoint::south, - tripoint::east, tripoint::above, - tripoint::below ); - tripoint_bub_ms test_bub( test_point ); + tripoint_bub_ms test_point = tripoint_bub_ms::zero + + GENERATE( tripoint_rel_ms::zero, tripoint_rel_ms::south, + tripoint_rel_ms::east, tripoint_rel_ms::above, + tripoint_rel_ms::below ); int z = GENERATE( 0, 1, -1, OVERMAP_HEIGHT, -OVERMAP_DEPTH ); // Make sure we're not in the 'easy' case where abs_sub is zero @@ -53,18 +52,18 @@ TEST_CASE( "map_coordinate_conversion_functions" ) point_abs_ms map_origin_ms = project_to( here.get_abs_sub().xy() ); - tripoint_abs_ms test_abs = map_origin_ms + rebase_rel( test_bub ); + tripoint_abs_ms test_abs = map_origin_ms + rebase_rel( test_point ); if( test_abs.z() > OVERMAP_HEIGHT || test_abs.z() < -OVERMAP_DEPTH ) { return; } - CAPTURE( test_bub ); + CAPTURE( test_point ); CAPTURE( test_abs ); // Verify round-tripping CHECK( here.getglobal( here.bub_from_abs( test_abs ) ) == test_abs ); - CHECK( here.bub_from_abs( here.getglobal( test_bub ) ) == test_bub ); + CHECK( here.bub_from_abs( here.getglobal( test_point ) ) == test_point ); } TEST_CASE( "destroy_grabbed_furniture" )