shrub/pkg/arvo/tests/sys/hoon/vases.hoon

38 lines
917 B
Plaintext
Raw Normal View History

2019-08-01 21:21:24 +03:00
/+ *test
|%
2019-08-01 22:02:25 +03:00
++ test-slam-wa-dry ^- tang
::
%+ expect-eq
!>(7)
-:(~(slam wa *worm) !>(add) !>([3 4]))
2019-08-01 23:14:29 +03:00
:: +test-slam-wa-wet: does +slam:wa perform correct wet type inference?
::
:: Also test that the cache doesn't gain any new entries when given a
:: sample of a previously seen type.
2019-08-01 22:02:25 +03:00
::
++ test-slam-wa-wet ^- tang
2019-08-01 23:14:29 +03:00
:: use the same .list-type for both calls
::
:: Types defined on different lines won't be noun-equal, and so
:: won't test that the cache kicked in on the second entry.
2019-08-01 22:02:25 +03:00
::
=/ list-type=type -:!>(*(list @))
=| worm0=worm
=+ [res1 worm1]=(~(slam wa worm0) !>(flop) [list-type ~[1 2 3]])
=+ [res2 worm2]=(~(slam wa worm1) !>(flop) [list-type ~[4 5 6]])
2019-08-01 21:21:24 +03:00
::
;: weld
%+ expect-eq
2019-08-01 22:02:25 +03:00
res1
[list-type ~[3 2 1]]
2019-08-01 21:21:24 +03:00
::
%+ expect-eq
2019-08-01 22:02:25 +03:00
res2
[list-type ~[6 5 4]]
2019-08-01 21:21:24 +03:00
::
2019-08-01 22:02:25 +03:00
%+ expect-eq
!> worm1
!> worm2
2019-08-01 21:21:24 +03:00
==
--