Skip to content

Commit

Permalink
chore: cleanup test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
he-ym committed Jan 12, 2024
1 parent 8913da5 commit 45e113a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/data_store/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ impl KeyValueStore {
fn _add(&mut self, key: String, value: i64) -> Option<Result<i64, CacheValueError>> {
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))
}
Expand Down
4 changes: 2 additions & 2 deletions src/public_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
);
}

0 comments on commit 45e113a

Please sign in to comment.