0.3.15-pre.010-fix.001
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
// file: crates/ksp-app-raw-transaction-ingest-desk/unit_tests/route_monitoring.rs
|
||||
// version: 1
|
||||
|
||||
#[test]
|
||||
fn pre_010_source_gap_and_repair_codes_are_exact_and_source_neutral() {
|
||||
assert_eq!(super::source_state_code(ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestSourceState::Active), "active");
|
||||
assert_eq!(super::source_state_code(ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestSourceState::Reconnecting), "reconnecting");
|
||||
assert_eq!(super::gap_state_code(ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestGapState::Repairing), "repairing");
|
||||
assert_eq!(super::gap_reason_code(ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestGapReason::SourceFailure), "source_failure");
|
||||
assert_eq!(
|
||||
super::repair_method_code(ksp_worker_raw_transaction_ingest_lib::RawTransactionIngestRepairMethod::TransactionHydration),
|
||||
"transaction_hydration"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_010_slot_projection_uses_decimal_text_for_javascript_safe_exactness() {
|
||||
assert_eq!(super::slot_text(std::option::Option::Some(u64::MAX)), std::option::Option::Some(u64::MAX.to_string()));
|
||||
assert_eq!(super::slot_text(std::option::Option::None), std::option::Option::None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_010_bounded_cardinality_projection_rejects_only_unrepresentable_values() {
|
||||
let zero = super::usize_to_u32(0, "zero");
|
||||
assert!(matches!(zero, std::result::Result::Ok(0)));
|
||||
let maximum = usize::try_from(u32::MAX);
|
||||
assert!(maximum.is_ok());
|
||||
if let std::result::Result::Ok(maximum) = maximum {
|
||||
let converted = super::usize_to_u32(maximum, "maximum");
|
||||
assert!(matches!(converted, std::result::Result::Ok(u32::MAX)));
|
||||
}
|
||||
if usize::BITS > u32::BITS {
|
||||
let overflow_value = usize::try_from(u64::from(u32::MAX) + 1);
|
||||
assert!(overflow_value.is_ok());
|
||||
if let std::result::Result::Ok(overflow_value) = overflow_value {
|
||||
let overflow = super::usize_to_u32(overflow_value, "overflow");
|
||||
assert!(overflow.is_err());
|
||||
if let std::result::Result::Err(error) = overflow {
|
||||
assert_eq!(error.code(), crate::ERROR_CODE_APP_STATE_INVALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user