Unverified Commit 9faebb53 by Nicolás Venturo Committed by GitHub

Added makeInterfaceId tests. (#1530)

parent 714ab21a
pragma solidity ^0.4.24;
import "../ownership/Ownable.sol";
/**
* @title Ownable interface id calculator.
* @dev See the EIP165 specification for more information:
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md#specification
*/
contract OwnableInterfaceId {
function getInterfaceId() public pure returns (bytes4) {
Ownable i;
return i.owner.selector ^ i.isOwner.selector ^ i.renounceOwnership.selector ^ i.transferOwnership.selector;
}
}
const { makeInterfaceId } = require('../makeInterfaceId');
const OwnableInterfaceId = artifacts.require('OwnableInterfaceId');
require('chai')
.should();
describe('makeInterfaceId', function () {
it('calculates the EIP165 interface id from function signatures', async function () {
const calculator = await OwnableInterfaceId.new();
const ownableId = await calculator.getInterfaceId();
makeInterfaceId([
'owner()',
'isOwner()',
'renounceOwnership()',
'transferOwnership(address)',
]).should.equal(ownableId);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment