Add bytes32 to uint enumerable map (#3416)

This commit is contained in:
Artur
2022-05-23 09:02:27 +01:00
committed by GitHub
parent b61faf8368
commit de74c8c62c
4 changed files with 157 additions and 6 deletions

View File

@ -4,6 +4,7 @@ const AddressToUintMapMock = artifacts.require('AddressToUintMapMock');
const UintToAddressMapMock = artifacts.require('UintToAddressMapMock');
const Bytes32ToBytes32MapMock = artifacts.require('Bytes32ToBytes32MapMock');
const UintToUintMapMock = artifacts.require('UintToUintMapMock');
const Bytes32ToUintMapMock = artifacts.require('Bytes32ToUintMapMock');
const { shouldBehaveLikeMap } = require('./EnumerableMap.behavior');
@ -25,8 +26,8 @@ contract('EnumerableMap', function (accounts) {
});
shouldBehaveLikeMap(
[accountA, accountB, accountC],
[keyA, keyB, keyC],
[ accountA, accountB, accountC ],
[ keyA, keyB, keyC ],
new BN('0'),
);
});
@ -38,8 +39,8 @@ contract('EnumerableMap', function (accounts) {
});
shouldBehaveLikeMap(
[keyA, keyB, keyC],
[accountA, accountB, accountC],
[ keyA, keyB, keyC ],
[ accountA, accountB, accountC ],
constants.ZERO_ADDRESS,
);
});
@ -51,8 +52,8 @@ contract('EnumerableMap', function (accounts) {
});
shouldBehaveLikeMap(
[keyA, keyB, keyC].map(k => ('0x' + k.toString(16)).padEnd(66, '0')),
[bytesA, bytesB, bytesC],
[ keyA, keyB, keyC ].map(k => '0x' + k.toString(16).padEnd(64, '0')),
[ bytesA, bytesB, bytesC ],
constants.ZERO_BYTES32,
);
});
@ -69,4 +70,17 @@ contract('EnumerableMap', function (accounts) {
new BN('0'),
);
});
// Bytes32ToUintMap
describe('Bytes32ToUintMap', function () {
beforeEach(async function () {
this.map = await Bytes32ToUintMapMock.new();
});
shouldBehaveLikeMap(
[ bytesA, bytesB, bytesC ],
[ keyA, keyB, keyC ],
new BN('0'),
);
});
});