From 7b9815f288198b9df4172768c448065a3e8eb599 Mon Sep 17 00:00:00 2001 From: Chris Sellers Date: Sat, 27 Apr 2024 16:28:58 +1000 Subject: [PATCH] Add Cache tests --- nautilus_core/common/src/cache/mod.rs | 40 +++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/nautilus_core/common/src/cache/mod.rs b/nautilus_core/common/src/cache/mod.rs index 11d0d7255eb5..da161b48abf4 100644 --- a/nautilus_core/common/src/cache/mod.rs +++ b/nautilus_core/common/src/cache/mod.rs @@ -1701,14 +1701,50 @@ mod tests { } #[rstest] - fn test_general_when_no_value() { + fn test_cache_general_load_when_no_database() { + let mut cache = Cache::default(); + assert!(cache.cache_general().is_ok()); + } + + #[rstest] + fn test_cache_currencies_load_when_no_database() { + let mut cache = Cache::default(); + assert!(cache.cache_currencies().is_ok()); + } + + #[rstest] + fn test_cache_instruments_load_when_no_database() { + let mut cache = Cache::default(); + assert!(cache.cache_instruments().is_ok()); + } + + #[rstest] + fn test_cache_synthetics_when_no_database() { + let mut cache = Cache::default(); + assert!(cache.cache_synthetics().is_ok()); + } + + #[rstest] + fn test_cache_orders_when_no_database() { + let mut cache = Cache::default(); + assert!(cache.cache_orders().is_ok()); + } + + #[rstest] + fn test_cache_positions_when_no_database() { + let mut cache = Cache::default(); + assert!(cache.cache_positions().is_ok()); + } + + #[rstest] + fn test_get_general_when_no_value() { let cache = Cache::default(); let result = cache.get("A").unwrap(); assert_eq!(result, None); } #[rstest] - fn test_general_when_value() { + fn test_add_general_when_value() { let mut cache = Cache::default(); let key = "A";