Skip to content

Commit

Permalink
Added tests for invert side
Browse files Browse the repository at this point in the history
  • Loading branch information
golden-lucky-monkey committed Apr 14, 2022
1 parent d7e845a commit d9125d8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#[cfg(test)]
mod test_helpers {
use crate::helpers::{convert_increment_to_precision, read_settings, SettingsFile, write_to_csv};
use crate::helpers::{convert_increment_to_precision, invert_side, read_settings, SettingsFile,
Side, write_to_csv};

#[test]
fn test_convert_increment_to_precision() {
Expand All @@ -17,7 +18,7 @@ mod test_helpers {
filename,
rust_decimal::Decimal::from(10 as i64),
rust_decimal::Decimal::from(10 as i64),
&crate::helpers::Side::Sell,
&Side::Sell,
1 as usize,
).unwrap();

Expand Down Expand Up @@ -60,4 +61,13 @@ mod test_helpers {
assert_eq!(settings.orderbook_depth, 0 as u32);
std::fs::remove_file(filename).unwrap();
}

#[test]
fn test_invert_side() {
let inverted_sell_side = invert_side(ftx::rest::Side::Sell);
let inverted_buy_side = invert_side(ftx::rest::Side::Buy);

assert_eq!(inverted_sell_side, ftx::rest::Side::Buy);
assert_eq!(inverted_buy_side, ftx::rest::Side::Sell);
}
}

0 comments on commit d9125d8

Please sign in to comment.