diff --git a/Cargo.toml b/Cargo.toml index 08dd734..eb560d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "orderbook" version = "0.2.0" authors = ["Ɓukasz Bednarski "] edition = "2021" -rust-version = "1.80.1" +rust-version = "1.70" [dependencies] either = "1.13.0" diff --git a/src/book.rs b/src/book.rs index 68b6c65..d72925e 100644 --- a/src/book.rs +++ b/src/book.rs @@ -327,3 +327,19 @@ fn is_deeper(a: f64, b: f64, side: &Side) -> bool { Side::Ask => a + EPSILON < b, } } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_empty_order_book() { + let ob = OrderBook::new(); + assert!(ob.get_ladder(&Side::Bid).is_empty()); + assert!(ob.get_ladder(&Side::Ask).is_empty()); + assert_eq!(ob.best_bid(), None); + assert_eq!(ob.best_bid_size(), None); + assert_eq!(ob.best_ask(), None); + assert_eq!(ob.best_ask_size(), None); + } +}