Skip to content

Commit

Permalink
implement suggested fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
malik672 committed Jan 10, 2024
1 parent dc5747c commit f6724ac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/entities/fractions/currency_amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ mod tests {
#[should_panic(expected = "AMOUNT")]
fn test_token_amount_exceeds_max_uint256() {
let _w = CurrencyAmount::from_raw_amount(TOKEN18.clone(), MAX_UINT256.clone() + 1);
assert!(!_w.is_err(), "AMOUNT");
assert!(_w.is_ok(), "AMOUNT");
}

#[test]
#[should_panic(expected = "AMOUNT")]
fn test_token_amount_quotient_exceeds_max_uint256() {
let numerator: BigInt = (MAX_UINT256.clone() + 1) * 2;
let _w = CurrencyAmount::from_fractional_amount(TOKEN18.clone(), numerator, 2);
assert!(!_w.is_err(), "AMOUNT");
assert!(_w.is_ok(), "AMOUNT");
}

#[test]
Expand Down
8 changes: 4 additions & 4 deletions src/entities/fractions/fraction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ mod tests {
#[test]
fn test_less_than() {
assert!(Fraction::new(1, 10).unwrap() < Fraction::new(4, 12).unwrap());
assert!(!(Fraction::new(1, 3).unwrap() < Fraction::new(4, 12).unwrap()));
assert!(!(Fraction::new(5, 12).unwrap() < Fraction::new(4, 12).unwrap()));
assert!(Fraction::new(1, 3).unwrap() >= Fraction::new(4, 12).unwrap());
assert!(Fraction::new(5, 12).unwrap() >= Fraction::new(4, 12).unwrap());
}

#[test]
Expand All @@ -322,8 +322,8 @@ mod tests {

#[test]
fn test_greater_than() {
assert!(!(Fraction::new(1, 10).unwrap() > Fraction::new(4, 12).unwrap()));
assert!(!(Fraction::new(1, 3).unwrap() > Fraction::new(4, 12).unwrap()));
assert!(Fraction::new(1, 10).unwrap() <= Fraction::new(4, 12).unwrap());
assert!(Fraction::new(1, 3).unwrap() <= Fraction::new(4, 12).unwrap());
assert!(Fraction::new(5, 12).unwrap() > Fraction::new(4, 12).unwrap());
}

Expand Down
2 changes: 0 additions & 2 deletions src/entities/fractions/price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ where
pub base_currency: TBase,
pub quote_currency: TQuote,
pub scalar: Fraction,


}

impl<TBase, TQuote> Price<TBase, TQuote>
Expand Down

0 comments on commit f6724ac

Please sign in to comment.