Skip to content

Commit

Permalink
test: not sure if this should work or not
Browse files Browse the repository at this point in the history
  • Loading branch information
bonomat committed Nov 28, 2023
1 parent 4e104b4 commit 8a17da1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions dlc-manager/src/payout_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1290,4 +1290,38 @@ mod test {
assert_eq!(polynomial.evaluate(0), 10.0);
assert_eq!(polynomial.evaluate(1), 8.0);
}

#[test]
fn try_to_get_negative() {
let total_collateral_doesnt_matter = 1324451 + 1324451;

let polynomial = PolynomialPayoutCurvePiece {
payout_points: vec![
PayoutPoint {
event_outcome: 25207,
outcome_payout: 2648902,
extra_precision: 0,
},
PayoutPoint {
event_outcome: 25227,
outcome_payout: 2647503,
extra_precision: 0,
},
],
};


// this is where our payout curve fails
let outcome = 1048575;

let doesnt_matter = RoundingIntervals {
intervals: vec![RoundingInterval {
begin_interval: 0,
rounding_mod: 0,
}],
};
let result = polynomial.get_rounded_payout(outcome, &doesnt_matter, total_collateral_doesnt_matter);
// TODO: this should not fail I think
result.unwrap();
}
}

0 comments on commit 8a17da1

Please sign in to comment.