@@ -4698,17 +4698,17 @@ BENCHMARK(graph_rank<graph_flat_set>)->MinTime(10)->Name("graph_rank<absl::flat_
46984698#include < charconv> // `std::from_chars`, `std::to_chars`
46994699#include < stdexcept> // `std::runtime_error`, `std::out_of_range`
47004700
4701- constexpr std::size_t fail_period_read_integer = 6 ;
4702- constexpr std::size_t fail_period_convert_to_integer = 11 ;
4703- constexpr std::size_t fail_period_next_string = 17 ;
4704- constexpr std::size_t fail_period_write_back = 23 ;
4701+ constexpr std::size_t fail_period_read_integer_k = 6 ;
4702+ constexpr std::size_t fail_period_convert_to_integer_k = 11 ;
4703+ constexpr std::size_t fail_period_next_string_k = 17 ;
4704+ constexpr std::size_t fail_period_write_back_k = 23 ;
47054705
47064706double get_max_value (std::vector<double > const &v) noexcept { return *(std::max_element (std::begin (v), std::end (v))); }
47074707
47084708static std::string read_integer_from_file_or_throw ( //
47094709 [[maybe_unused]] std::string const &filename, std::size_t iteration_index) noexcept (false ) {
4710- if (iteration_index % fail_period_read_integer == 0 ) throw std::runtime_error (" File read failed" );
4711- if (iteration_index % fail_period_convert_to_integer == 0 ) return " abc" ;
4710+ if (iteration_index % fail_period_read_integer_k == 0 ) throw std::runtime_error (" File read failed" );
4711+ if (iteration_index % fail_period_convert_to_integer_k == 0 ) return " abc" ;
47124712 // Technically, the constructor may throw `std::bad_alloc` if the allocation fails,
47134713 // but given the Small String Optimization, it shouldn't happen in practice.
47144714 return " 1" ;
@@ -4728,7 +4728,7 @@ static std::size_t string_to_integer_or_throw( //
47284728}
47294729
47304730static std::string integer_to_next_string_or_throw (std::size_t value, std::size_t iteration_index) noexcept (false ) {
4731- if (iteration_index % fail_period_next_string == 0 ) throw std::runtime_error (" Increment failed" );
4731+ if (iteration_index % fail_period_next_string_k == 0 ) throw std::runtime_error (" Increment failed" );
47324732 value++;
47334733 constexpr std::size_t buffer_size = 10 ;
47344734 char buffer[buffer_size] {};
@@ -4740,7 +4740,7 @@ static std::string integer_to_next_string_or_throw(std::size_t value, std::size_
47404740static void write_to_file_or_throw ( //
47414741 [[maybe_unused]] std::string const &filename, [[maybe_unused]] std::string const &value,
47424742 std::size_t iteration_index) noexcept (false ) {
4743- if (iteration_index % fail_period_write_back == 0 ) throw std::runtime_error (" File write failed" );
4743+ if (iteration_index % fail_period_write_back_k == 0 ) throw std::runtime_error (" File write failed" );
47444744}
47454745
47464746static void errors_throw (bm::State &state) {
@@ -4791,8 +4791,8 @@ class expected {
47914791
47924792static expected<std::string> read_integer_from_file_or_variants ( //
47934793 [[maybe_unused]] std::string const &filename, std::size_t iteration_index) noexcept {
4794- if (iteration_index % fail_period_read_integer == 0 ) return std::error_code {EIO, std::generic_category ()};
4795- if (iteration_index % fail_period_convert_to_integer == 0 ) return " abc" s;
4794+ if (iteration_index % fail_period_read_integer_k == 0 ) return std::error_code {EIO, std::generic_category ()};
4795+ if (iteration_index % fail_period_convert_to_integer_k == 0 ) return " abc" s;
47964796 // Technically, the constructor may throw `std::bad_alloc` if the allocation fails,
47974797 // but given the Small String Optimization, it shouldn't happen in practice.
47984798 return " 1" s;
@@ -4808,7 +4808,7 @@ static expected<std::size_t> string_to_integer_or_variants( //
48084808
48094809static expected<std::string> integer_to_next_string_or_variants (std::size_t value,
48104810 std::size_t iteration_index) noexcept {
4811- if (iteration_index % fail_period_next_string == 0 ) return std::error_code {EIO, std::generic_category ()};
4811+ if (iteration_index % fail_period_next_string_k == 0 ) return std::error_code {EIO, std::generic_category ()};
48124812 value++;
48134813 constexpr std::size_t buffer_size = 10 ;
48144814 char buffer[buffer_size] {};
@@ -4820,7 +4820,7 @@ static expected<std::string> integer_to_next_string_or_variants(std::size_t valu
48204820static std::error_code write_to_file_or_variants ( //
48214821 [[maybe_unused]] std::string const &filename, [[maybe_unused]] std::string const &value,
48224822 std::size_t iteration_index) noexcept {
4823- if (iteration_index % fail_period_write_back == 0 ) return std::error_code {EIO, std::generic_category ()};
4823+ if (iteration_index % fail_period_write_back_k == 0 ) return std::error_code {EIO, std::generic_category ()};
48244824 return std::error_code {};
48254825}
48264826
@@ -4869,8 +4869,8 @@ struct result {
48694869
48704870static result<std::string> read_integer_from_file_with_status ( //
48714871 [[maybe_unused]] std::string const &filename, std::size_t iteration_index) noexcept {
4872- if (iteration_index % fail_period_read_integer == 0 ) return {{}, status::read_failed};
4873- if (iteration_index % fail_period_convert_to_integer == 0 ) return {" abc" s, status::success};
4872+ if (iteration_index % fail_period_read_integer_k == 0 ) return {{}, status::read_failed};
4873+ if (iteration_index % fail_period_convert_to_integer_k == 0 ) return {" abc" s, status::success};
48744874 // Technically, the constructor may throw `std::bad_alloc` if the allocation fails,
48754875 // but given the Small String Optimization, it shouldn't happen in practice.
48764876 return {" 1" s, status::success};
@@ -4885,7 +4885,7 @@ static result<std::size_t> string_to_integer_with_status( //
48854885}
48864886
48874887static result<std::string> integer_to_next_string_with_status (std::size_t value, std::size_t iteration_index) noexcept {
4888- if (iteration_index % fail_period_next_string == 0 ) return {{}, status::increment_failed};
4888+ if (iteration_index % fail_period_next_string_k == 0 ) return {{}, status::increment_failed};
48894889 value++;
48904890 constexpr std::size_t buffer_size = 10 ;
48914891 char buffer[buffer_size] {};
@@ -4897,7 +4897,7 @@ static result<std::string> integer_to_next_string_with_status(std::size_t value,
48974897static status write_to_file_with_status ( //
48984898 [[maybe_unused]] std::string const &filename, [[maybe_unused]] std::string const &value,
48994899 std::size_t iteration_index) noexcept {
4900- if (iteration_index % fail_period_write_back == 0 ) return status::write_failed;
4900+ if (iteration_index % fail_period_write_back_k == 0 ) return status::write_failed;
49014901 return status::success;
49024902}
49034903
0 commit comments