mirror of
https://github.com/urbit/shrub.git
synced 2024-12-20 01:01:37 +03:00
b3901ab42f
git-subtree-dir: pkg/arvo git-subtree-mainline:9c8f40bf6c
git-subtree-split:c20e2a185f
54 lines
1.1 KiB
Plaintext
54 lines
1.1 KiB
Plaintext
/+ *test
|
|
|%
|
|
::NOTE tests lightly modified from the examples here:
|
|
:: https://github.com/ethereum/wiki/wiki/RLP
|
|
::
|
|
++ test-encoding-string
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
b+3^0xaa.bbcc
|
|
!> 0x83aa.bbcc
|
|
::
|
|
++ test-encoding-list
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
l+~[b+3^0xaa.bbcc b+3^0xdd.eeff]
|
|
!> 0xc8.83aa.bbcc.83dd.eeff
|
|
::
|
|
++ test-encoding-empty-list
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
l+~
|
|
!> 0xc0
|
|
::
|
|
++ test-encoding-zero-byte
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
b+1^0x0
|
|
!> 0x0
|
|
::
|
|
++ test-encoding-empty-zero
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
b+0^0x0
|
|
!> 0x80
|
|
::
|
|
++ test-encoding-15
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
b+1^15
|
|
!> 0xf
|
|
::
|
|
++ test-encoding-1024
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
b+2^1.024
|
|
!> 0x82.0400
|
|
::
|
|
++ test-encoding-set-of-three
|
|
%+ expect-eq
|
|
!> %- encode:rlp:ethereum
|
|
l+[l+~ l+[l+~ ~] l+[l+~ l+[l+~ ~] ~] ~]
|
|
!> 0xc7c0.c1c0.c3c0.c1c0
|
|
--
|