From dbc0058cf7122beb4680af05f7e9bfc137f08b59 Mon Sep 17 00:00:00 2001 From: mrq Date: Thu, 16 May 2024 15:59:36 +0200 Subject: [PATCH 1/2] BEEFY test --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 2b762ea..749c04e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -166,6 +166,11 @@ pub mod xyk { xyk::calculate_spot_price_with_fee(String::from("1000"), String::from("0"), String::from("3"), String::from("1000")), "0" ); + + assert_ne!( + xyk::calculate_spot_price_with_fee(String::from("5039030951140853"), String::from("6987280000000000"), String::from("3"), String::from("1000")), + "0" + ); } #[test] From e6f3dc08ddb82305a05248db08038cb7e6507228 Mon Sep 17 00:00:00 2001 From: mrq Date: Thu, 16 May 2024 17:26:42 +0200 Subject: [PATCH 2/2] precision test on spot price --- src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 749c04e..c567a16 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -166,9 +166,16 @@ pub mod xyk { xyk::calculate_spot_price_with_fee(String::from("1000"), String::from("0"), String::from("3"), String::from("1000")), "0" ); + } + #[test] + fn calculate_spot_price_has_better_precision() { assert_ne!( - xyk::calculate_spot_price_with_fee(String::from("5039030951140853"), String::from("6987280000000000"), String::from("3"), String::from("1000")), + xyk::calculate_spot_price(String::from("5039030951140853000"), String::from("6987280000000000")), + "0" + ); + assert_eq!( + xyk::get_spot_price(String::from("5039030951140853000"), String::from("6987280000000000"), String::from("100")), "0" ); }