From 889d3e9c1ee5efc13f1758027fcdb4e413cde6dd Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Tue, 9 Jan 2024 15:52:33 -0600 Subject: [PATCH] GH-37 Rename variable to make clearer --- tests/eosio.system_tester.hpp | 6 +++--- tests/eosio.system_tests.cpp | 34 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/eosio.system_tester.hpp b/tests/eosio.system_tester.hpp index a5c38be4..f2a6a823 100644 --- a/tests/eosio.system_tester.hpp +++ b/tests/eosio.system_tester.hpp @@ -1024,9 +1024,9 @@ class eosio_system_tester : public TESTER { } produce_blocks( 250 ); - auto producer_keys = control->active_producers(); - BOOST_REQUIRE_EQUAL( 21, producer_keys.producers.size() ); - BOOST_REQUIRE_EQUAL( name("defproducera"), producer_keys.producers[0].producer_name ); + auto producer_schedule = control->active_producers(); + BOOST_REQUIRE_EQUAL( 21, producer_schedule.producers.size() ); + BOOST_REQUIRE_EQUAL( name("defproducera"), producer_schedule.producers[0].producer_name ); return producer_names; } diff --git a/tests/eosio.system_tests.cpp b/tests/eosio.system_tests.cpp index 3b37bbec..545a13c6 100644 --- a/tests/eosio.system_tests.cpp +++ b/tests/eosio.system_tests.cpp @@ -3187,9 +3187,9 @@ BOOST_FIXTURE_TEST_CASE( elect_producers /*_and_parameters*/, eosio_system_teste //vote for producers BOOST_REQUIRE_EQUAL( success(), vote( "alice1111111"_n, { "defproducer1"_n } ) ); produce_blocks(250); - auto producer_keys = control->active_producers(); - BOOST_REQUIRE_EQUAL( 1, producer_keys.producers.size() ); - BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_keys.producers[0].producer_name ); + auto producer_schedule = control->active_producers(); + BOOST_REQUIRE_EQUAL( 1, producer_schedule.producers.size() ); + BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_schedule.producers[0].producer_name ); //auto config = config_to_variant( control->get_global_properties().configuration ); //auto prod1_config = testing::filter_fields( config, producer_parameters_example( 1 ) ); @@ -3203,10 +3203,10 @@ BOOST_FIXTURE_TEST_CASE( elect_producers /*_and_parameters*/, eosio_system_teste BOOST_REQUIRE_EQUAL( success(), vote( "bob111111111"_n, { "defproducer2"_n } ) ); ilog("."); produce_blocks(250); - producer_keys = control->active_producers(); - BOOST_REQUIRE_EQUAL( 2, producer_keys.producers.size() ); - BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_keys.producers[0].producer_name ); - BOOST_REQUIRE_EQUAL( name("defproducer2"), producer_keys.producers[1].producer_name ); + producer_schedule = control->active_producers(); + BOOST_REQUIRE_EQUAL( 2, producer_schedule.producers.size() ); + BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_schedule.producers[0].producer_name ); + BOOST_REQUIRE_EQUAL( name("defproducer2"), producer_schedule.producers[1].producer_name ); //config = config_to_variant( control->get_global_properties().configuration ); //auto prod2_config = testing::filter_fields( config, producer_parameters_example( 2 ) ); //REQUIRE_EQUAL_OBJECTS(prod2_config, config); @@ -3214,26 +3214,26 @@ BOOST_FIXTURE_TEST_CASE( elect_producers /*_and_parameters*/, eosio_system_teste // elect 3 producers BOOST_REQUIRE_EQUAL( success(), vote( "bob111111111"_n, { "defproducer2"_n, "defproducer3"_n } ) ); produce_blocks(250); - producer_keys = control->active_producers(); - BOOST_REQUIRE_EQUAL( 3, producer_keys.producers.size() ); - BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_keys.producers[0].producer_name ); - BOOST_REQUIRE_EQUAL( name("defproducer2"), producer_keys.producers[1].producer_name ); - BOOST_REQUIRE_EQUAL( name("defproducer3"), producer_keys.producers[2].producer_name ); + producer_schedule = control->active_producers(); + BOOST_REQUIRE_EQUAL( 3, producer_schedule.producers.size() ); + BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_schedule.producers[0].producer_name ); + BOOST_REQUIRE_EQUAL( name("defproducer2"), producer_schedule.producers[1].producer_name ); + BOOST_REQUIRE_EQUAL( name("defproducer3"), producer_schedule.producers[2].producer_name ); //config = config_to_variant( control->get_global_properties().configuration ); //REQUIRE_EQUAL_OBJECTS(prod2_config, config); // try to go back to 2 producers and fail BOOST_REQUIRE_EQUAL( success(), vote( "bob111111111"_n, { "defproducer3"_n } ) ); produce_blocks(250); - producer_keys = control->active_producers(); - BOOST_REQUIRE_EQUAL( 3, producer_keys.producers.size() ); + producer_schedule = control->active_producers(); + BOOST_REQUIRE_EQUAL( 3, producer_schedule.producers.size() ); // The test below is invalid now, producer schedule is not updated if there are // fewer producers in the new schedule /* - BOOST_REQUIRE_EQUAL( 2, producer_keys.size() ); - BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_keys[0].producer_name ); - BOOST_REQUIRE_EQUAL( name("defproducer3"), producer_keys[1].producer_name ); + BOOST_REQUIRE_EQUAL( 2, producer_schedule.size() ); + BOOST_REQUIRE_EQUAL( name("defproducer1"), producer_schedule[0].producer_name ); + BOOST_REQUIRE_EQUAL( name("defproducer3"), producer_schedule[1].producer_name ); //config = config_to_variant( control->get_global_properties().configuration ); //auto prod3_config = testing::filter_fields( config, producer_parameters_example( 3 ) ); //REQUIRE_EQUAL_OBJECTS(prod3_config, config);