mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-25 08:21:10 +00:00
Support NMap in generate_storage_alias (#9147)
* Support NMap in generate_storage_alias * Verify that 2-key NMap is identical to DoubleMap * Also compare key hashes and make sure they're identical * Fix and add tests for 1-tuple NMap generated by generate_storage_alias
This commit is contained in:
@@ -433,6 +433,26 @@ mod test_iterators {
|
||||
prefix
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn n_map_double_map_identical_key() {
|
||||
sp_io::TestExternalities::default().execute_with(|| {
|
||||
NMap::insert((1, 2), 50);
|
||||
let key_hash = NMap::hashed_key_for((1, 2));
|
||||
|
||||
{
|
||||
crate::generate_storage_alias!(Test, NMap => DoubleMap<
|
||||
(u16, crate::Blake2_128Concat),
|
||||
(u32, crate::Twox64Concat),
|
||||
u64
|
||||
>);
|
||||
|
||||
let value = NMap::get(1, 2).unwrap();
|
||||
assert_eq!(value, 50);
|
||||
assert_eq!(NMap::hashed_key_for(1, 2), key_hash);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn n_map_reversible_reversible_iteration() {
|
||||
sp_io::TestExternalities::default().execute_with(|| {
|
||||
|
||||
Reference in New Issue
Block a user