mirror of
https://github.com/urbit/shrub.git
synced 2024-12-18 15:55:00 +03:00
tests: ames sends %watch %plea
This commit is contained in:
parent
e2e4a102e8
commit
1f9e04ab1c
@ -1,11 +1,13 @@
|
||||
/+ *test, test-pub, test-sub
|
||||
/= ames /sys/vane/ames
|
||||
/= ames-raw /sys/vane/ames
|
||||
/= gall-raw /sys/vane/gall
|
||||
::
|
||||
=/ ames-bunt (ames-raw ~zod)
|
||||
=/ gall-bunt (gall-raw ~zod)
|
||||
::
|
||||
|%
|
||||
++ gall-gate _(make-gall ~zod)
|
||||
+$ gall-gate _(make-gall ~zod)
|
||||
+$ ames-gate _nec:ames-nec-bud
|
||||
++ nec-bud
|
||||
=/ a ames-nec-bud
|
||||
=/ gall-nec (make-gall ~nec)
|
||||
@ -49,11 +51,28 @@
|
||||
|= [=gall-gate =wire =duct =sign-arvo =roof]
|
||||
%. [wire duct dud=~ sign-arvo]
|
||||
take:(gall-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
|
||||
:: +ames-check-call: run gall task, assert produces expected-moves
|
||||
::
|
||||
++ ames-check-call
|
||||
|= $: =ames-gate
|
||||
[now=@da eny=@ =roof]
|
||||
[=duct task=(hobo task:ames)]
|
||||
expected-moves=(list move:ames-bunt)
|
||||
==
|
||||
^- [tang ^ames-gate]
|
||||
=/ ames-core (ames-gate now eny roof)
|
||||
=^ moves ames-gate (call:ames-core duct dud=~ task)
|
||||
[(expect-eq !>(expected-moves) !>(moves)) ames-gate]
|
||||
::
|
||||
++ ames-call
|
||||
|= [=ames-gate =duct task=(hobo task:ames) =roof]
|
||||
%. [duct dud=~ task]
|
||||
call:(ames-gate now=~1111.1.1 eny=`@`0xdead.beef roof)
|
||||
::
|
||||
++ ames-nec-bud
|
||||
:: create ~nec
|
||||
::
|
||||
=/ nec (ames ~nec)
|
||||
=/ nec (ames-raw ~nec)
|
||||
=. now.nec ~1111.1.1
|
||||
=. eny.nec 0xdead.beef
|
||||
=. life.ames-state.nec 2
|
||||
@ -63,7 +82,7 @@
|
||||
=/ nec-sec sec:ex:crypto-core.ames-state.nec
|
||||
:: create ~bud
|
||||
::
|
||||
=/ bud (ames ~bud)
|
||||
=/ bud (ames-raw ~bud)
|
||||
=. now.bud ~1111.1.1
|
||||
=. eny.bud 0xbeef.dead
|
||||
=. life.ames-state.bud 3
|
||||
@ -72,8 +91,8 @@
|
||||
=/ bud-pub pub:ex:crypto-core.ames-state.bud
|
||||
=/ bud-sec sec:ex:crypto-core.ames-state.bud
|
||||
::
|
||||
=/ nec-sym (derive-symmetric-key:ames bud-pub nec-sec)
|
||||
=/ bud-sym (derive-symmetric-key:ames nec-pub bud-sec)
|
||||
=/ nec-sym (derive-symmetric-key:ames-raw bud-pub nec-sec)
|
||||
=/ bud-sym (derive-symmetric-key:ames-raw nec-pub bud-sec)
|
||||
?> =(nec-sym bud-sym)
|
||||
:: tell ~nec about ~bud
|
||||
::
|
||||
|
@ -31,7 +31,34 @@
|
||||
==
|
||||
==
|
||||
:- t2 |. :- %|
|
||||
=/ t3 ~
|
||||
=^ t3 ames.nec
|
||||
%: ames-check-call:v ames.nec
|
||||
[~1111.1.1 0xdead.beef *roof]
|
||||
[~[/sys/way/~bud/pub /init] %plea ~bud %g /ge/pub %pub [%0 %s /foo]]
|
||||
:~ :- ~[//unix]
|
||||
:* %give %send [%& ~nec]
|
||||
0x79ca.8314.59aa.4ee3.b4bf.9f31.8a0b.1ba1.e19d.7b83.
|
||||
84a0.209b.2000.193c.d818.2da8.9309.759f.9e8c.b88e.
|
||||
1cb8.8400.0200.0132.e478.8000
|
||||
==
|
||||
:- ~[/ames] [%pass /pump/~bud/0 %b %wait ~1111.1.1..00.00.01]
|
||||
==
|
||||
==
|
||||
:- t3 |. :- %|
|
||||
=^ t4 ames.nec
|
||||
%: ames-check-call:v ames.bud
|
||||
[~1111.1.2 0xbeef.dead *roof]
|
||||
:- ~[//unix]
|
||||
:* %hear [%& ~nec]
|
||||
0x79ca.8314.59aa.4ee3.b4bf.9f31.8a0b.1ba1.e19d.7b83.
|
||||
84a0.209b.2000.193c.d818.2da8.9309.759f.9e8c.b88e.
|
||||
1cb8.8400.0200.0132.e478.8000
|
||||
==
|
||||
:~ :- ~[//unix] [%pass /qos %d %flog %text "; ~nec is your neighbor"]
|
||||
:- ~[//unix]
|
||||
[%pass /bone/~nec/0/1 %g %plea ~nec %g /ge/pub %pub [%0 %s /foo]]
|
||||
==
|
||||
==
|
||||
:: =^ t3 gall.nec
|
||||
:: %: gall-check-take:v gall.nec
|
||||
:: [~1111.1.2 0xdead.beef *roof]
|
||||
@ -40,5 +67,5 @@
|
||||
:: [%g %deal [~nec ~bud] %pub %watch /foo]
|
||||
:: ~
|
||||
:: ==
|
||||
:- t3 |. :- %& ~
|
||||
:- t4 |. :- %& ~
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user