Skip to content

Commit 46fb72e

Browse files
committed
initialize constants randomly
1 parent 60c0f53 commit 46fb72e

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

test/data/BinaryHeap.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,28 @@ import { expect } from 'chai';
1313
import { BigNumber } from 'ethers';
1414
import { ethers } from 'hardhat';
1515

16-
const numbers = [0, 1, 2].map((n) => BigNumber.from(n));
17-
18-
const constants = {
19-
bytes32: numbers.map((n) => bnToBytes32(n)),
20-
address: numbers.map((n) => bnToAddress(n)),
21-
uint256: numbers,
22-
};
23-
24-
const randomBytes32 = () => ethers.utils.randomBytes(32);
16+
const randomBytes32 = () => ethers.utils.hexlify(ethers.utils.randomBytes(32));
2517

2618
const randomAddress = () =>
2719
ethers.utils.getAddress(ethers.utils.hexlify(ethers.utils.randomBytes(20)));
2820

2921
const randomUint256 = () => ethers.BigNumber.from(ethers.utils.randomBytes(32));
3022

23+
const constants = {
24+
bytes32: new Array(3)
25+
.fill()
26+
.map(() => randomBytes32())
27+
.sort(),
28+
address: new Array(3)
29+
.fill()
30+
.map(() => randomAddress())
31+
.sort(),
32+
uint256: new Array(3)
33+
.fill()
34+
.map(() => randomUint256())
35+
.sort(),
36+
};
37+
3138
// checks that the parent node is greater than or equal to the children nodes
3239
function checkNodes(nodes: string[] | BigNumber[]) {
3340
nodes.forEach((node, index) => {

0 commit comments

Comments
 (0)