|
|
@ -11,35 +11,41 @@ contract('TotallyPure', accounts => { |
|
|
|
|
|
|
|
|
|
|
|
it('calls an imported, inherited pure function', async () => { |
|
|
|
it('calls an imported, inherited pure function', async () => { |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const value = await instance.isPure.call(4, 5); |
|
|
|
const value = await instance.isPure(4, 5); |
|
|
|
assert.equal(value.toNumber(), 20); |
|
|
|
assert.equal(value.toNumber(), 20); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('calls an imported, inherited view function', async () => { |
|
|
|
it('calls an imported, inherited view function', async () => { |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const value = await instance.isView.call(); |
|
|
|
const value = await instance.isView(); |
|
|
|
assert.equal(value.toNumber(), 5); |
|
|
|
assert.equal(value.toNumber(), 5); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('calls an imported, inherited constant function', async () => { |
|
|
|
it('calls an imported, inherited constant function', async () => { |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const value = await instance.isConstant.call(); |
|
|
|
const value = await instance.isConstant(); |
|
|
|
assert.equal(value.toNumber(), 99); |
|
|
|
assert.equal(value.toNumber(), 99); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('overrides an imported, inherited abstract pure function', async () => { |
|
|
|
it('overrides an imported, inherited abstract pure function', async () => { |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const value = await instance.bePure.call(4, 5); |
|
|
|
const value = await instance.bePure(4, 5); |
|
|
|
assert.equal(value.toNumber(), 9); |
|
|
|
assert.equal(value.toNumber(), 9); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('overrides an imported, inherited abstract view function', async () => { |
|
|
|
it('overrides an imported, inherited abstract view function', async () => { |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const value = await instance.beView.call(); |
|
|
|
const value = await instance.beView(); |
|
|
|
assert.equal(value.toNumber(), 99); |
|
|
|
assert.equal(value.toNumber(), 99); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('overrides an imported, inherited abstract constant function', async () => { |
|
|
|
it('overrides an imported, inherited abstract constant function', async () => { |
|
|
|
|
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
|
|
|
|
const value = await instance.beConstant(); |
|
|
|
|
|
|
|
assert.equal(value.toNumber(), 99); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('overrides an imported, inherited abstract constant function, and uses .call()', async () => { |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const instance = await TotallyPure.deployed(); |
|
|
|
const value = await instance.beConstant.call(); |
|
|
|
const value = await instance.beConstant.call(); |
|
|
|
assert.equal(value.toNumber(), 99); |
|
|
|
assert.equal(value.toNumber(), 99); |
|
|
|