mirror of
https://github.com/tornadocash/tornado-trees.git
synced 2024-12-04 07:07:25 +01:00
lint
This commit is contained in:
parent
55937915c4
commit
5492acd75c
@ -28,40 +28,70 @@ describe('findArrayLength', () => {
|
||||
})
|
||||
|
||||
it('should work for even array', async () => {
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(publicArray.address, 'deposits(uint256)', 4, 2)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(
|
||||
publicArray.address,
|
||||
'deposits(uint256)',
|
||||
4,
|
||||
2,
|
||||
)
|
||||
expect(depositsLength).to.be.equal(depositsEven.length)
|
||||
})
|
||||
|
||||
it('should work for empty array', async () => {
|
||||
publicArray = await PublicArray.deploy()
|
||||
// will throw out of gas if you pass non zero params
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(publicArray.address, 'deposits(uint256)', 0, 0)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(
|
||||
publicArray.address,
|
||||
'deposits(uint256)',
|
||||
0,
|
||||
0,
|
||||
)
|
||||
expect(depositsLength).to.be.equal(0)
|
||||
})
|
||||
|
||||
it('should work for odd array', async () => {
|
||||
publicArray = await PublicArray.deploy()
|
||||
await publicArray.setDeposits(depositsOdd)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(publicArray.address, 'deposits(uint256)', 4, 2)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(
|
||||
publicArray.address,
|
||||
'deposits(uint256)',
|
||||
4,
|
||||
2,
|
||||
)
|
||||
expect(depositsLength).to.be.equal(depositsOdd.length)
|
||||
})
|
||||
|
||||
it('should work for even array and odd step', async () => {
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(publicArray.address, 'deposits(uint256)', 4, 3)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(
|
||||
publicArray.address,
|
||||
'deposits(uint256)',
|
||||
4,
|
||||
3,
|
||||
)
|
||||
expect(depositsLength).to.be.equal(depositsEven.length)
|
||||
})
|
||||
|
||||
it('should work for odd array and odd step', async () => {
|
||||
publicArray = await PublicArray.deploy()
|
||||
await publicArray.setDeposits(depositsOdd)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(publicArray.address, 'deposits(uint256)', 4, 3)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(
|
||||
publicArray.address,
|
||||
'deposits(uint256)',
|
||||
4,
|
||||
3,
|
||||
)
|
||||
expect(depositsLength).to.be.equal(depositsOdd.length)
|
||||
})
|
||||
|
||||
it('should work for odd array and step 1', async () => {
|
||||
publicArray = await PublicArray.deploy()
|
||||
await publicArray.setDeposits(depositsOdd)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(publicArray.address, 'deposits(uint256)', 4, 1)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(
|
||||
publicArray.address,
|
||||
'deposits(uint256)',
|
||||
4,
|
||||
1,
|
||||
)
|
||||
expect(depositsLength).to.be.equal(depositsOdd.length)
|
||||
})
|
||||
|
||||
@ -82,7 +112,12 @@ describe('findArrayLength', () => {
|
||||
const deposits = Array.from(Array(30).keys())
|
||||
publicArray = await PublicArray.deploy()
|
||||
await publicArray.setDeposits(deposits)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(publicArray.address, 'deposits(uint256)', 1, 50)
|
||||
const depositsLength = await tornadoTrees.findArrayLengthMock(
|
||||
publicArray.address,
|
||||
'deposits(uint256)',
|
||||
1,
|
||||
50,
|
||||
)
|
||||
expect(depositsLength).to.be.equal(deposits.length)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user