From a3ea930b8a14a08db7c745ef63ad4211367931a5 Mon Sep 17 00:00:00 2001 From: Mauro Lacy Date: Fri, 28 Jan 2022 15:22:35 +0100 Subject: [PATCH] Remove redundant / repeated test cases --- packages/storage-plus/src/map.rs | 109 ------------------------------- 1 file changed, 109 deletions(-) diff --git a/packages/storage-plus/src/map.rs b/packages/storage-plus/src/map.rs index 962e94297..0b50944ab 100644 --- a/packages/storage-plus/src/map.rs +++ b/packages/storage-plus/src/map.rs @@ -902,50 +902,6 @@ mod test { all, vec![(b"spender".to_vec(), 1000), (b"spender2".to_vec(), 3000),] ); - } - - #[test] - #[cfg(feature = "iterator")] - fn range2_composite_key() { - let mut store = MockStorage::new(); - - // save and load on three keys, one under different owner - ALLOWANCE - .save(&mut store, (b"owner", b"spender"), &1000) - .unwrap(); - ALLOWANCE - .save(&mut store, (b"owner", b"spender2"), &3000) - .unwrap(); - ALLOWANCE - .save(&mut store, (b"owner2", b"spender"), &5000) - .unwrap(); - - // let's try to iterate! - let all: StdResult> = ALLOWANCE - .range(&store, None, None, Order::Ascending) - .collect(); - let all = all.unwrap(); - assert_eq!(3, all.len()); - assert_eq!( - all, - vec![ - ((b"owner".to_vec(), b"spender".to_vec()), 1000), - ((b"owner".to_vec(), b"spender2".to_vec()), 3000), - ((b"owner2".to_vec(), b"spender".to_vec()), 5000) - ] - ); - - // let's try to iterate over a prefix - let all: StdResult> = ALLOWANCE - .prefix(b"owner") - .range(&store, None, None, Order::Ascending) - .collect(); - let all = all.unwrap(); - assert_eq!(2, all.len()); - assert_eq!( - all, - vec![(b"spender".to_vec(), 1000), (b"spender2".to_vec(), 3000),] - ); // let's try to iterate over a prefixed restricted inclusive range let all: StdResult> = ALLOWANCE @@ -1112,71 +1068,6 @@ mod test { ("recipient2".to_string(), 3000), ] ); - } - - #[test] - #[cfg(feature = "iterator")] - fn range2_triple_key() { - let mut store = MockStorage::new(); - - // save and load on three keys, one under different owner - TRIPLE - .save(&mut store, (b"owner", 9u8, "recipient"), &1000) - .unwrap(); - TRIPLE - .save(&mut store, (b"owner", 9u8, "recipient2"), &3000) - .unwrap(); - TRIPLE - .save(&mut store, (b"owner", 10u8, "recipient3"), &3000) - .unwrap(); - TRIPLE - .save(&mut store, (b"owner2", 9u8, "recipient"), &5000) - .unwrap(); - - // let's try to iterate! - let all: StdResult> = TRIPLE.range(&store, None, None, Order::Ascending).collect(); - let all = all.unwrap(); - assert_eq!(4, all.len()); - assert_eq!( - all, - vec![ - ((b"owner".to_vec(), 9, "recipient".to_string()), 1000), - ((b"owner".to_vec(), 9, "recipient2".to_string()), 3000), - ((b"owner".to_vec(), 10, "recipient3".to_string()), 3000), - ((b"owner2".to_vec(), 9, "recipient".to_string()), 5000) - ] - ); - - // let's iterate over a sub_prefix - let all: StdResult> = TRIPLE - .sub_prefix(b"owner") - .range(&store, None, None, Order::Ascending) - .collect(); - let all = all.unwrap(); - assert_eq!(3, all.len()); - assert_eq!( - all, - vec![ - ((9, "recipient".to_string()), 1000), - ((9, "recipient2".to_string()), 3000), - ((10, "recipient3".to_string()), 3000), - ] - ); - - // let's iterate over a prefix - let all: StdResult> = TRIPLE - .prefix((b"owner", 9)) - .range(&store, None, None, Order::Ascending) - .collect(); - let all = all.unwrap(); - assert_eq!(2, all.len()); - assert_eq!( - all, - vec![ - ("recipient".to_string(), 1000), - ("recipient2".to_string(), 3000), - ] - ); // let's try to iterate over a prefixed restricted inclusive range let all: StdResult> = TRIPLE