Skip to content

Commit 1077b61

Browse files
authored
Add threshold boundary regression (#57)
1 parent 698e016 commit 1077b61

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

apexchainx_calculator/src/tests.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,26 @@ fn test_exact_threshold_mttr_is_always_met_never_violated() {
604604
}
605605
}
606606

607+
#[test]
608+
fn test_threshold_boundary_keeps_equality_met_and_plus_one_violated() {
609+
let (_env, client, _actors) = setup();
610+
611+
let exact =
612+
client.calculate_sla_view(&symbol_short!("BND_EX"), &symbol_short!("critical"), &15);
613+
let plus_one =
614+
client.calculate_sla_view(&symbol_short!("BND_P1"), &symbol_short!("critical"), &16);
615+
616+
assert_eq!(exact.status, symbol_short!("met"));
617+
assert_eq!(exact.payment_type, symbol_short!("rew"));
618+
assert_eq!(exact.rating, symbol_short!("good"));
619+
assert!(exact.amount > 0);
620+
621+
assert_eq!(plus_one.status, symbol_short!("viol"));
622+
assert_eq!(plus_one.payment_type, symbol_short!("pen"));
623+
assert_eq!(plus_one.rating, symbol_short!("poor"));
624+
assert!(plus_one.amount < 0);
625+
}
626+
607627
#[test]
608628
fn test_exact_threshold_boundary_is_stable_after_config_update() {
609629
let (_env, client, actors) = setup();

0 commit comments

Comments
 (0)