github.com/aigarnetwork/aigar@v0.0.0-20191115204914-d59a6eb70f8e/tests/solidity/test/opCodes.js (about) 1 /* 2 * // Copyright 2018 The go-ethereum Authors 3 * // Copyright 2019 The go-aigar Authors 4 * // This file is part of the go-aigar library. 5 * // 6 * // The go-aigar library is free software: you can redistribute it and/or modify 7 * // it under the terms of the GNU Lesser General Public License as published by 8 * // the Free Software Foundation, either version 3 of the License, or 9 * // (at your option) any later version. 10 * // 11 * // The go-aigar library is distributed in the hope that it will be useful, 12 * // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * // GNU Lesser General Public License for more details. 15 * // 16 * // You should have received a copy of the GNU Lesser General Public License 17 * // along with the go-aigar library. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 const TodoList = artifacts.require('./OpCodes.sol') 21 const assert = require('assert') 22 let contractInstance 23 const Web3 = require('web3'); 24 const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); 25 // const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:9545')); 26 27 contract('OpCodes', (accounts) => { 28 beforeEach(async () => { 29 contractInstance = await TodoList.deployed() 30 }) 31 it('Should run without errors the majorit of opcodes', async () => { 32 await contractInstance.test() 33 await contractInstance.test_stop() 34 35 }) 36 37 it('Should throw invalid op code', async () => { 38 try{ 39 await contractInstance.test_invalid() 40 } 41 catch(error) { 42 console.error(error); 43 } 44 }) 45 46 it('Should revert', async () => { 47 try{ 48 await contractInstance.test_revert() } 49 catch(error) { 50 console.error(error); 51 } 52 }) 53 })