2018-08-28 20:08:04 +03:00
|
|
|
/+ tester
|
|
|
|
|_ _tester:tester
|
2018-02-16 03:18:47 +03:00
|
|
|
::TODO copy this:
|
|
|
|
:: https://github.com/ethereum/web3.js/blob/master/test/coder.encodeParam.js
|
|
|
|
++ test-testing-the-tests
|
2018-08-28 20:08:04 +03:00
|
|
|
(expect-eq !>([4 4]))
|
2018-02-16 03:18:47 +03:00
|
|
|
::
|
|
|
|
++ test-static-args
|
2018-08-28 20:08:04 +03:00
|
|
|
=- (expect-eq !>([res wan]))
|
|
|
|
^- [res=tape wan=tape]
|
|
|
|
:- %- encode-args:ethereum
|
2018-02-16 03:18:47 +03:00
|
|
|
:~ [%string "dave"]
|
|
|
|
[%bool &]
|
|
|
|
[%array [%uint 1] [%uint 2] [%uint 3] ~]
|
|
|
|
==
|
2018-08-28 20:08:04 +03:00
|
|
|
%- zing
|
|
|
|
:~ "0000000000000000000000000000000000000000000000000000000000000060"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000001"
|
|
|
|
"00000000000000000000000000000000000000000000000000000000000000a0"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000004"
|
|
|
|
"6461766500000000000000000000000000000000000000000000000000000000"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000003"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000001"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000002"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000003"
|
|
|
|
==
|
2018-02-16 03:18:47 +03:00
|
|
|
::
|
|
|
|
++ test-dynamic-args
|
2018-08-28 20:08:04 +03:00
|
|
|
=- (expect-eq !>([res wan]))
|
|
|
|
^- [res=tape wan=tape]
|
|
|
|
:- %- encode-args:ethereum
|
2018-02-16 03:18:47 +03:00
|
|
|
:~ [%uint `@ud`0x123]
|
|
|
|
[%array [%uint `@ud`0x456] [%uint `@ud`0x789] ~]
|
2018-08-28 20:08:04 +03:00
|
|
|
[%bytes-n (as-octt:mimes:html (flop "1234567890"))]
|
|
|
|
[%bytes (as-octt:mimes:html (flop "Hello, world!"))]
|
2018-02-16 03:18:47 +03:00
|
|
|
==
|
2018-08-28 20:08:04 +03:00
|
|
|
%- zing
|
|
|
|
:~ "0000000000000000000000000000000000000000000000000000000000000123"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000080"
|
|
|
|
"3132333435363738393000000000000000000000000000000000000000000000"
|
|
|
|
"00000000000000000000000000000000000000000000000000000000000000e0"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000002"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000456"
|
|
|
|
"0000000000000000000000000000000000000000000000000000000000000789"
|
|
|
|
"000000000000000000000000000000000000000000000000000000000000000d"
|
|
|
|
"48656c6c6f2c20776f726c642100000000000000000000000000000000000000"
|
|
|
|
==
|
2018-02-16 03:18:47 +03:00
|
|
|
--
|