From 45e113a0c21d1da2ce1e25ba26709d9cc24ce2f7 Mon Sep 17 00:00:00 2001 From: Yatharth Mathur Date: Fri, 12 Jan 2024 15:27:28 +0530 Subject: [PATCH] chore: cleanup test cases --- src/data_store/store.rs | 4 ++-- src/public_tests.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data_store/store.rs b/src/data_store/store.rs index c6370b7..3df7c47 100644 --- a/src/data_store/store.rs +++ b/src/data_store/store.rs @@ -106,8 +106,8 @@ impl KeyValueStore { fn _add(&mut self, key: String, value: i64) -> Option> { if let Some(value_entry) = self._data.get_mut(&key) { match value_entry.get_value_as_i64() { - Ok(integer) => { - let updated_integer_value = integer + value; + Ok(old_value) => { + let updated_integer_value = old_value + value; value_entry.value = CacheValue::Integer64(updated_integer_value); Some(Ok(updated_integer_value)) } diff --git a/src/public_tests.rs b/src/public_tests.rs index 191418b..e63c387 100644 --- a/src/public_tests.rs +++ b/src/public_tests.rs @@ -203,9 +203,9 @@ fn test_incr_decr() { assert_eq!(store.incr("ABC".to_string(), None).unwrap().unwrap(), 69); assert_eq!(store.get_i64("ABC".to_string()).unwrap().unwrap(), 69); - assert_eq!(store.decr("ABC".to_string(), None).unwrap().unwrap(), 68); + assert_eq!(store.decr("ABC".to_string(), Some(8)).unwrap().unwrap(), 61); assert_eq!( store.get_string("ABC".to_string()).unwrap().unwrap(), - "68".to_string() + "61".to_string() ); }