Skip to content

Commit

Permalink
program: add test for decreasing step size
Browse files Browse the repository at this point in the history
  • Loading branch information
crispheaney committed Oct 23, 2023
1 parent bc436c9 commit 1e105ec
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions programs/drift/src/math/orders/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,26 @@ pub mod standardize_base_asset_amount {
}
}

pub mod is_multiple_of_step_size {
use crate::math::orders::is_multiple_of_step_size;

#[test]
fn reduce_step_size() {
let base_asset_amount: u64 = 200000;
let step_size: u64 = 100000;

let result = is_multiple_of_step_size(base_asset_amount, step_size).unwrap();

assert!(result);

let step_size = step_size / 10;

let result = is_multiple_of_step_size(base_asset_amount, step_size).unwrap();

assert!(result);
}
}

mod is_order_risk_increase {
use crate::controller::position::PositionDirection;
use crate::math::constants::{BASE_PRECISION_I64, BASE_PRECISION_U64};
Expand Down

0 comments on commit 1e105ec

Please sign in to comment.