mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-27 15:28:03 +00:00
style: Rename gtest test cases to snake_case
develop's new fix-gtest-names pre-commit hook requires a snake_case test-case name. CI runs it with --all-files, so the existing CamelCase names fail the check on every branch that carries these files.
This commit is contained in:
@@ -239,7 +239,7 @@ TEST(ConsensusSpanNames, validation_status_values_are_mutually_distinct)
|
||||
// THE RULE, over its whole live domain. The int arguments are
|
||||
// static_cast<int>(ValStatus), so this also pins the enumerator order: Current,
|
||||
// Stale, BadSeq, Multiple, Conflicting.
|
||||
TEST(ConsensusSpanNames, validationStatusValue_maps_every_val_status)
|
||||
TEST(ConsensusSpanNames, validation_status_value_maps_every_val_status)
|
||||
{
|
||||
EXPECT_EQ(consensus::span::validationStatusValue(0), consensus::span::val::statusCurrent);
|
||||
EXPECT_EQ(consensus::span::validationStatusValue(1), consensus::span::val::statusStale);
|
||||
@@ -252,7 +252,7 @@ TEST(ConsensusSpanNames, validationStatusValue_maps_every_val_status)
|
||||
// validation was counted for nothing. That split is the diagnostic value of the
|
||||
// attribute -- a node stuck below quorum receiving validations that are all
|
||||
// stale or bad-seq looks, from the outside, exactly like one receiving good ones.
|
||||
TEST(ConsensusSpanNames, validationStatusValue_separates_counted_from_rejected)
|
||||
TEST(ConsensusSpanNames, validation_status_value_separates_counted_from_rejected)
|
||||
{
|
||||
EXPECT_EQ(consensus::span::validationStatusValue(0), "current");
|
||||
for (int const rejected : {1, 2, 3, 4})
|
||||
@@ -265,7 +265,7 @@ TEST(ConsensusSpanNames, validationStatusValue_separates_counted_from_rejected)
|
||||
// NEGATIVE: an out-of-domain value yields the sentinel, never an empty string.
|
||||
// An empty attribute value would add a blank series to the aggregated dimension,
|
||||
// which is worse than a value labelled "unknown".
|
||||
TEST(ConsensusSpanNames, validationStatusValue_out_of_domain_is_unknown_not_empty)
|
||||
TEST(ConsensusSpanNames, validation_status_value_out_of_domain_is_unknown_not_empty)
|
||||
{
|
||||
for (int const bad : {-1, 5, 6, 99})
|
||||
{
|
||||
@@ -278,7 +278,7 @@ TEST(ConsensusSpanNames, validationStatusValue_out_of_domain_is_unknown_not_empt
|
||||
// The mapping is a compile-time rule, so a wrong value cannot even be built --
|
||||
// the strongest form of the guarantee, checked by the compiler rather than at
|
||||
// run time.
|
||||
TEST(ConsensusSpanNames, validationStatusValue_is_a_compile_time_rule)
|
||||
TEST(ConsensusSpanNames, validation_status_value_is_a_compile_time_rule)
|
||||
{
|
||||
static_assert(consensus::span::validationStatusValue(0) == "current");
|
||||
static_assert(consensus::span::validationStatusValue(2) == "bad_seq");
|
||||
|
||||
@@ -66,7 +66,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::span<double const>{kChargeBuckets},
|
||||
std::span<double const>{kRotationPhaseSecondsBuckets}));
|
||||
|
||||
TEST(HistogramBucketsRange, rotationPhaseLadderSpansSecondsToAnHour)
|
||||
TEST(HistogramBucketsRange, rotation_phase_ladder_spans_seconds_to_an_hour)
|
||||
{
|
||||
// Phases run from seconds (freshen.keys) to ten minutes or more (copy), and
|
||||
// a whole rotation about a quarter of an hour. The floor must sit under the
|
||||
|
||||
@@ -131,13 +131,13 @@ TEST(LedgerSpanNames, acquire_reason_values_mirror_the_reason_enum)
|
||||
EXPECT_EQ(std::string_view(ledger_span::val::generic), "generic");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, acquireOutcome_normal_done_path_is_complete)
|
||||
TEST(LedgerSpanNames, acquire_outcome_normal_done_path_is_complete)
|
||||
{
|
||||
// done() after all data was assembled: complete_ set, failed_ clear.
|
||||
EXPECT_EQ(ledger_span::acquireOutcome(/*failed=*/false, /*complete=*/true), "complete");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, acquireOutcome_local_complete_path_is_complete)
|
||||
TEST(LedgerSpanNames, acquire_outcome_local_complete_path_is_complete)
|
||||
{
|
||||
// The tryDB local-store shortcut in init() reaches the same flag state as
|
||||
// done(), so it must produce the same outcome -- this is the exit that used
|
||||
@@ -145,14 +145,14 @@ TEST(LedgerSpanNames, acquireOutcome_local_complete_path_is_complete)
|
||||
EXPECT_EQ(ledger_span::acquireOutcome(/*failed=*/false, /*complete=*/true), "complete");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, acquireOutcome_failed_path_is_failed)
|
||||
TEST(LedgerSpanNames, acquire_outcome_failed_path_is_failed)
|
||||
{
|
||||
// Terminal error: bad data, a zero account hash, or the retry budget ran
|
||||
// out. Reached from done() and from the early-return in init().
|
||||
EXPECT_EQ(ledger_span::acquireOutcome(/*failed=*/true, /*complete=*/false), "failed");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, acquireOutcome_abort_path_is_abandoned)
|
||||
TEST(LedgerSpanNames, acquire_outcome_abort_path_is_abandoned)
|
||||
{
|
||||
// The destructor / sweep path: neither flag set, because the fetch never
|
||||
// reached a result. This is the assertion the whole change exists for -- an
|
||||
@@ -160,7 +160,7 @@ TEST(LedgerSpanNames, acquireOutcome_abort_path_is_abandoned)
|
||||
EXPECT_EQ(ledger_span::acquireOutcome(/*failed=*/false, /*complete=*/false), "abandoned");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, acquireOutcome_failure_wins_over_completion)
|
||||
TEST(LedgerSpanNames, acquire_outcome_failure_wins_over_completion)
|
||||
{
|
||||
// Edge case: both flags set. A fetch that hit a terminal error is not a
|
||||
// success regardless of what was assembled, so `failed` must win. Pinned
|
||||
@@ -169,7 +169,7 @@ TEST(LedgerSpanNames, acquireOutcome_failure_wins_over_completion)
|
||||
EXPECT_EQ(ledger_span::acquireOutcome(/*failed=*/true, /*complete=*/true), "failed");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, acquireOutcome_covers_its_whole_input_domain)
|
||||
TEST(LedgerSpanNames, acquire_outcome_covers_its_whole_input_domain)
|
||||
{
|
||||
// No input combination yields an empty or unknown value, which is the
|
||||
// property that guarantees an exit path can never end up with a blank
|
||||
@@ -191,7 +191,7 @@ TEST(LedgerSpanNames, acquireOutcome_covers_its_whole_input_domain)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, acquireOutcome_is_a_compile_time_rule)
|
||||
TEST(LedgerSpanNames, acquire_outcome_is_a_compile_time_rule)
|
||||
{
|
||||
// constexpr, so the rule costs nothing at the four call sites and can be
|
||||
// asserted by the compiler itself. static_assert here is the strongest
|
||||
@@ -481,7 +481,7 @@ TEST(LedgerSpanNames, serve_outcome_values_are_the_three_terminal_states)
|
||||
std::string_view(ledger_span::val::refused), std::string_view(ledger_span::val::complete));
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, phaseOutcome_normal_completion_is_complete)
|
||||
TEST(LedgerSpanNames, phase_outcome_normal_completion_is_complete)
|
||||
{
|
||||
// A phase whose tree assembled, or a tx set that arrived: complete_ set,
|
||||
// nothing else. Reached from receiveNode()/trigger() for a phase and from
|
||||
@@ -491,7 +491,7 @@ TEST(LedgerSpanNames, phaseOutcome_normal_completion_is_complete)
|
||||
"complete");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, phaseOutcome_bad_data_is_failed)
|
||||
TEST(LedgerSpanNames, phase_outcome_bad_data_is_failed)
|
||||
{
|
||||
// A terminal data fault with no timeout: a peer served a tree or set that
|
||||
// would not build. This is the case `timeout` must NOT absorb.
|
||||
@@ -500,7 +500,7 @@ TEST(LedgerSpanNames, phaseOutcome_bad_data_is_failed)
|
||||
"failed");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, phaseOutcome_exhausted_budget_reports_timeout_not_failed)
|
||||
TEST(LedgerSpanNames, phase_outcome_exhausted_budget_reports_timeout_not_failed)
|
||||
{
|
||||
// THE assertion this rule exists for, and the one that would regress
|
||||
// silently. Both emitters' exhausted-budget path sets timedOut_ AND
|
||||
@@ -513,7 +513,7 @@ TEST(LedgerSpanNames, phaseOutcome_exhausted_budget_reports_timeout_not_failed)
|
||||
"timeout");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, phaseOutcome_timeout_outranks_a_late_completion)
|
||||
TEST(LedgerSpanNames, phase_outcome_timeout_outranks_a_late_completion)
|
||||
{
|
||||
// Edge case: the budget expired and the data then arrived. It still reports
|
||||
// `timeout`, because the retry budget was really spent -- counting it as a
|
||||
@@ -523,7 +523,7 @@ TEST(LedgerSpanNames, phaseOutcome_timeout_outranks_a_late_completion)
|
||||
"timeout");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, phaseOutcome_dropped_mid_fetch_is_abandoned)
|
||||
TEST(LedgerSpanNames, phase_outcome_dropped_mid_fetch_is_abandoned)
|
||||
{
|
||||
// No flag at all: the object was destroyed while still fetching (the
|
||||
// InboundLedger sweep, or InboundTransactions::newRound dropping a set).
|
||||
@@ -534,7 +534,7 @@ TEST(LedgerSpanNames, phaseOutcome_dropped_mid_fetch_is_abandoned)
|
||||
"abandoned");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, phaseOutcome_covers_its_whole_input_domain)
|
||||
TEST(LedgerSpanNames, phase_outcome_covers_its_whole_input_domain)
|
||||
{
|
||||
// No input combination yields an empty or undeclared value, which is the
|
||||
// property that guarantees no exit can end up with a blank outcome and that
|
||||
@@ -569,7 +569,7 @@ TEST(LedgerSpanNames, phaseOutcome_covers_its_whole_input_domain)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, phaseOutcome_is_a_compile_time_rule)
|
||||
TEST(LedgerSpanNames, phase_outcome_is_a_compile_time_rule)
|
||||
{
|
||||
// constexpr, so the rule costs nothing at its call sites and the mapping is
|
||||
// fixed by the compiler itself.
|
||||
@@ -580,7 +580,7 @@ TEST(LedgerSpanNames, phaseOutcome_is_a_compile_time_rule)
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, serveObjectType_maps_every_protobuf_itype)
|
||||
TEST(LedgerSpanNames, serve_object_type_maps_every_protobuf_itype)
|
||||
{
|
||||
// The exact protobuf TMLedgerInfoType values, which are fixed by the wire
|
||||
// protocol: liBASE=0, liTX_NODE=1, liAS_NODE=2, liTS_CANDIDATE=3. Passed as
|
||||
@@ -591,7 +591,7 @@ TEST(LedgerSpanNames, serveObjectType_maps_every_protobuf_itype)
|
||||
EXPECT_EQ(ledger_span::serveObjectType(3), "txset");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, serveObjectType_never_yields_an_undeclared_value)
|
||||
TEST(LedgerSpanNames, serve_object_type_never_yields_an_undeclared_value)
|
||||
{
|
||||
// Edge case: an out-of-range itype cannot occur -- PeerImp::onMessage
|
||||
// rejects the request before the worker runs -- but the rule must still
|
||||
@@ -605,7 +605,7 @@ TEST(LedgerSpanNames, serveObjectType_never_yields_an_undeclared_value)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, serveOutcome_empty_reply_is_refused)
|
||||
TEST(LedgerSpanNames, serve_outcome_empty_reply_is_refused)
|
||||
{
|
||||
// Seven of the eight exits of processLedgerRequest send nothing, and all of
|
||||
// them reach this through a zero node count. Deriving the value from the
|
||||
@@ -613,13 +613,13 @@ TEST(LedgerSpanNames, serveOutcome_empty_reply_is_refused)
|
||||
EXPECT_EQ(ledger_span::serveOutcome(/*servedNodes=*/0, /*softCap=*/128), "refused");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, serveOutcome_partial_reply_below_cap_is_complete)
|
||||
TEST(LedgerSpanNames, serve_outcome_partial_reply_below_cap_is_complete)
|
||||
{
|
||||
EXPECT_EQ(ledger_span::serveOutcome(/*servedNodes=*/12, /*softCap=*/128), "complete");
|
||||
EXPECT_EQ(ledger_span::serveOutcome(/*servedNodes=*/127, /*softCap=*/128), "complete");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, serveOutcome_reply_at_the_cap_is_partial)
|
||||
TEST(LedgerSpanNames, serve_outcome_reply_at_the_cap_is_partial)
|
||||
{
|
||||
// Edge case at the exact boundary: the assembly loop stops here, so the
|
||||
// requester must come back for the rest. Counting it as a success would
|
||||
@@ -628,7 +628,7 @@ TEST(LedgerSpanNames, serveOutcome_reply_at_the_cap_is_partial)
|
||||
EXPECT_EQ(ledger_span::serveOutcome(/*servedNodes=*/256, /*softCap=*/128), "partial");
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, serveOutcome_never_yields_an_undeclared_value)
|
||||
TEST(LedgerSpanNames, serve_outcome_never_yields_an_undeclared_value)
|
||||
{
|
||||
// Negative counts cannot occur (nodes_size() is non-negative) but must
|
||||
// still map to a declared value rather than an empty attribute.
|
||||
@@ -643,7 +643,7 @@ TEST(LedgerSpanNames, serveOutcome_never_yields_an_undeclared_value)
|
||||
}
|
||||
}
|
||||
|
||||
TEST(LedgerSpanNames, serveOutcome_is_a_compile_time_rule)
|
||||
TEST(LedgerSpanNames, serve_outcome_is_a_compile_time_rule)
|
||||
{
|
||||
static_assert(ledger_span::serveOutcome(0, 128) == std::string_view("refused"));
|
||||
static_assert(ledger_span::serveOutcome(1, 128) == std::string_view("complete"));
|
||||
|
||||
@@ -954,7 +954,7 @@ makeLedgerHashBytes(std::uint8_t seed)
|
||||
// THE CONTRACT, positive half: three stages of one ledger, created
|
||||
// independently, all land in ONE trace whose id IS the ledger hash. This is what
|
||||
// makes a slow ledger readable as one connected trace instead of three orphans.
|
||||
TEST_F(SpanGuardScopeTest, ledgerJoin_same_hash_puts_every_stage_in_one_trace)
|
||||
TEST_F(SpanGuardScopeTest, ledger_join_same_hash_puts_every_stage_in_one_trace)
|
||||
{
|
||||
auto const h = makeLedgerHashBytes(0x11);
|
||||
{
|
||||
@@ -997,7 +997,7 @@ TEST_F(SpanGuardScopeTest, ledgerJoin_same_hash_puts_every_stage_in_one_trace)
|
||||
// THE CONTRACT, negative half: two different ledgers must never share a trace.
|
||||
// Without this the join would be useless -- a single trace would accumulate
|
||||
// every ledger the node ever touched.
|
||||
TEST_F(SpanGuardScopeTest, ledgerJoin_different_hashes_never_share_a_trace)
|
||||
TEST_F(SpanGuardScopeTest, ledger_join_different_hashes_never_share_a_trace)
|
||||
{
|
||||
auto const first = makeLedgerHashBytes(0x20);
|
||||
auto const second = makeLedgerHashBytes(0x60);
|
||||
@@ -1029,7 +1029,7 @@ TEST_F(SpanGuardScopeTest, ledgerJoin_different_hashes_never_share_a_trace)
|
||||
// acquire-completion job and from the consensus thread; if the span inherited an
|
||||
// ambient parent it would be swallowed into an unrelated trace on some of those
|
||||
// paths and its trace id would no longer be the ledger hash.
|
||||
TEST_F(SpanGuardScopeTest, ledgerJoin_ignores_an_ambient_parent)
|
||||
TEST_F(SpanGuardScopeTest, ledger_join_ignores_an_ambient_parent)
|
||||
{
|
||||
auto const h = makeLedgerHashBytes(0x33);
|
||||
{
|
||||
@@ -1061,7 +1061,7 @@ TEST_F(SpanGuardScopeTest, ledgerJoin_ignores_an_ambient_parent)
|
||||
// is one trace. It is keyed on the VALIDATED ledger hash -- the key
|
||||
// ledger.validate uses -- and deliberately NOT on the previous-ledger hash that
|
||||
// seeds the consensus round trace, which stays a separate trace.
|
||||
TEST_F(SpanGuardScopeTest, ledgerJoin_validationAccept_joins_the_validated_ledger)
|
||||
TEST_F(SpanGuardScopeTest, ledger_join_validation_accept_joins_the_validated_ledger)
|
||||
{
|
||||
auto const validated = makeLedgerHashBytes(0x41);
|
||||
auto const previous = makeLedgerHashBytes(0x81);
|
||||
@@ -1099,7 +1099,7 @@ TEST_F(SpanGuardScopeTest, ledgerJoin_validationAccept_joins_the_validated_ledge
|
||||
// guard rather than a span in a garbage trace. The emitters always pass a full
|
||||
// 32-byte hash, so this is the guard rail: a truncated key degrades to "no span"
|
||||
// instead of to a wrong join.
|
||||
TEST_F(SpanGuardScopeTest, ledgerJoin_too_short_a_key_yields_no_span)
|
||||
TEST_F(SpanGuardScopeTest, ledger_join_too_short_a_key_yields_no_span)
|
||||
{
|
||||
std::array<std::uint8_t, 8> const tooShort{1, 2, 3, 4, 5, 6, 7, 8};
|
||||
auto span = SpanGuard::hashSpan(
|
||||
|
||||
Reference in New Issue
Block a user