Skip to content

Commit bc98287

Browse files
Merge pull request #60 from dfinity/Shah/fix-test-precision
Fix: increase test precision
2 parents 5aa925f + a95335b commit bc98287

File tree

2 files changed

+97
-5
lines changed

2 files changed

+97
-5
lines changed

Cargo.lock

Lines changed: 91 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kongswap_adaptor/tests/lifecycle.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,13 @@ async fn lifecycle_test() {
195195
(expected - observed).abs() <= expected.abs() * tolerance
196196
}
197197

198-
let error_tolerance = 0.00001;
198+
// @todo
199+
// due to rounding errors in the calculations, we allow for a very small
200+
// tolerance in the checks below. This should be fixed in the future.
201+
let error_tolerance = 0.000001;
199202

200203
assert!(is_within_tolerance(
201-
(11999246569_u64 - 9 * FEE_SNS) as f64,
204+
11999216568_u64 as f64,
202205
decode_nat_to_u64(
203206
balances_0
204207
.treasury_owner
@@ -212,7 +215,7 @@ async fn lifecycle_test() {
212215
));
213216

214217
assert!(is_within_tolerance(
215-
(12001107784_u64 - 9 * FEE_ICP) as f64,
218+
12001077785_u64 as f64,
216219
decode_nat_to_u64(
217220
balances_1
218221
.treasury_owner

0 commit comments

Comments
 (0)