import BigNumber from 'bn.js' ; import { q18 , typedAssert } from 'test-utils' ; import { DataTypesInputInstance } from '../types/truffle-contracts/DataTypesInput' ; const DataTypesInput = artifacts . require ( 'DataTypesInput' ) ; contract ( 'DataTypesInput' , ( [ deployer ] ) => { let c ; beforeEach ( async ( ) => { c = await DataTypesInput . new ( { from : deployer } ) ; } ) ; it ( 'works' , async ( ) => { typedAssert ( await c . input_uint8 ( '42' ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_uint8 ( 42 ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_uint8 ( new BigNumber ( 42 ) ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_uint256 ( q18 ( 1 ) ) , new BigNumber ( q18 ( 1 ) ) ) ; typedAssert ( await c . input_uint256 ( 1 ) , new BigNumber ( '1' ) ) ; typedAssert ( await c . input_uint256 ( new BigNumber ( 42 ) ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_int8 ( '42' ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_int8 ( 42 ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_int8 ( new BigNumber ( 42 ) ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_int256 ( q18 ( 1 ) ) , new BigNumber ( q18 ( 1 ) ) ) ; typedAssert ( await c . input_int256 ( 1 ) , new BigNumber ( '1' ) ) ; typedAssert ( await c . input_int256 ( new BigNumber ( 42 ) ) , new BigNumber ( '42' ) ) ; typedAssert ( await c . input_bool ( true ) , true ) ; typedAssert ( await c . input_address ( '0x70b144972C5Ef6CB941A5379240B74239c418CD4' ) , '0x70b144972C5Ef6CB941A5379240B74239c418CD4' ) ; typedAssert ( await c . input_bytes1 ( '0xaa' ) , '0xaa' ) ; typedAssert ( await c . input_bytes ( web3 . utils . fromAscii ( 'TypeChain' ) ) , '0x54797065436861696e' ) ; typedAssert ( await c . input_string ( 'TypeChain' ) , 'TypeChain' ) ; typedAssert ( await c . input_stat_array ( [ '1' , '2' , '3' ] ) , [ new BigNumber ( '1' ) , new BigNumber ( '2' ) , new BigNumber ( '3' ) ] ) ; typedAssert ( await c . input_stat_array ( [ 1 , 2 , 3 ] ) , [ new BigNumber ( '1' ) , new BigNumber ( '2' ) , new BigNumber ( '3' ) ] ) ; typedAssert ( await c . input_stat_array ( [ new BigNumber ( '1' ) , new BigNumber ( '2' ) , new BigNumber ( '3' ) ] ) , [ new BigNumber ( '1' ) , new BigNumber ( '2' ) , new BigNumber ( '3' ) , ] ) ; typedAssert ( await c . input_tuple ( '1' , '2' ) , [ new BigNumber ( '1' ) , new BigNumber ( '2' ) ] ) ; typedAssert ( await c . input_tuple ( 1 , 2 ) , [ new BigNumber ( '1' ) , new BigNumber ( '2' ) ] ) ; typedAssert ( await c . input_tuple ( new BigNumber ( 1 ) , new BigNumber ( 2 ) ) , [ new BigNumber ( '1' ) , new BigNumber ( '2' ) ] ) ; typedAssert ( await c . input_enum ( '1' ) , new BigNumber ( '1' ) ) ; typedAssert ( await c . input_enum ( 1 ) , new BigNumber ( '1' ) ) ; typedAssert ( await c . input_enum ( new BigNumber ( '1' ) ) , new BigNumber ( '1' ) ) ; } ) ; } ) ;