Moved EnumerableSet to utils.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
pragma solidity ^0.5.10;
|
||||
import "../drafts/EnumerableSet.sol";
|
||||
import "../utils/EnumerableSet.sol";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -11,41 +11,41 @@ const c = '0x0000000000000000000000000000000000000003';
|
||||
/** @test {EnumerableSet} contract */
|
||||
describe('EnumerableSet', function () {
|
||||
beforeEach(async function () {
|
||||
this.enumerableSet = await EnumerableSetMock.new();
|
||||
this.set = await EnumerableSetMock.new();
|
||||
});
|
||||
|
||||
it('contains can return false.', async function () {
|
||||
expect(await this.enumerableSet.testContains(a)).to.be.false;
|
||||
expect(await this.set.testContains(a)).to.be.false;
|
||||
});
|
||||
|
||||
it('adds an value.', async function () {
|
||||
await this.enumerableSet.testAdd(a);
|
||||
expect(await this.enumerableSet.testContains(a)).to.be.true;
|
||||
await this.set.testAdd(a);
|
||||
expect(await this.set.testContains(a)).to.be.true;
|
||||
});
|
||||
|
||||
it('adds several values.', async function () {
|
||||
await this.enumerableSet.testAdd(a);
|
||||
await this.enumerableSet.testAdd(b);
|
||||
expect(await this.enumerableSet.testContains(a)).to.be.true;
|
||||
expect(await this.enumerableSet.testContains(b)).to.be.true;
|
||||
expect(await this.enumerableSet.testContains(c)).to.be.false;
|
||||
await this.set.testAdd(a);
|
||||
await this.set.testAdd(b);
|
||||
expect(await this.set.testContains(a)).to.be.true;
|
||||
expect(await this.set.testContains(b)).to.be.true;
|
||||
expect(await this.set.testContains(c)).to.be.false;
|
||||
});
|
||||
|
||||
it('removes values.', async function () {
|
||||
await this.enumerableSet.testAdd(a);
|
||||
await this.enumerableSet.testRemove(a);
|
||||
expect(await this.enumerableSet.testContains(a)).to.be.false;
|
||||
await this.set.testAdd(a);
|
||||
await this.set.testRemove(a);
|
||||
expect(await this.set.testContains(a)).to.be.false;
|
||||
});
|
||||
|
||||
it('Retrieve an empty array', async function () {
|
||||
expect(await this.enumerableSet.testEnumerate()).to.be.empty;
|
||||
expect(await this.set.testEnumerate()).to.be.empty;
|
||||
});
|
||||
|
||||
it('Retrieve an array of values', async function () {
|
||||
await this.enumerableSet.testAdd(a);
|
||||
await this.enumerableSet.testAdd(b);
|
||||
await this.enumerableSet.testAdd(c);
|
||||
const result = (await this.enumerableSet.testEnumerate());
|
||||
await this.set.testAdd(a);
|
||||
await this.set.testAdd(b);
|
||||
await this.set.testAdd(c);
|
||||
const result = (await this.set.testEnumerate());
|
||||
expect(result.length).to.be.equal(3);
|
||||
expect(result[0]).to.be.equal(a);
|
||||
expect(result[1]).to.be.equal(b);
|
||||
Reference in New Issue
Block a user