mall: fix tests

This commit is contained in:
Philip Monk 2019-11-13 20:00:56 -08:00
parent 607a2c0ac6
commit 881517c872
No known key found for this signature in database
GPG Key ID: B66E1F02604E44EC
8 changed files with 36 additions and 140 deletions

View File

@ -63,7 +63,7 @@
=^ cards state =^ cards state
?+ mark (on-poke:def mark vase) ?+ mark (on-poke:def mark vase)
%handle-http-request %handle-http-request
(handle-http-request:lsp !<([eyre-id=@ta inbound-request:eyre vase)) (handle-http-request:lsp !<([eyre-id=@ta inbound-request:eyre] vase))
== ==
[cards this] [cards this]
:: ::
@ -126,6 +126,7 @@
:: ::
++ handle-http-request ++ handle-http-request
|= [eyre-id=@ta =inbound-request:eyre] |= [eyre-id=@ta =inbound-request:eyre]
^- (quip card _state)
?> ?=(^ body.request.inbound-request) ?> ?=(^ body.request.inbound-request)
=/ =lsp-req =/ =lsp-req
%- parser %- parser
@ -138,6 +139,7 @@
== ==
=. bufs =. bufs
(~(put by bufs) uri.lsp-req buf) (~(put by bufs) uri.lsp-req buf)
:_ state
%+ give-simple-payload:app eyre-id %+ give-simple-payload:app eyre-id
%+ require-authorization:app inbound-request %+ require-authorization:app inbound-request
|= =inbound-request:eyre |= =inbound-request:eyre

View File

@ -20,15 +20,17 @@
-- --
=; core =; core
^- imp:spider ^- imp:spider
|= =bowl:spider |= [=bowl:spider args=vase]
=/ m (thread ,~) =/ m (thread ,vase)
^- form:m ^- form:m
;< ~ bind:m (subscribe-our:threadio /effects %aqua /effect) ;< ~ bind:m (watch-our:threadio /effects %aqua /effect)
;< ~ bind:m
%- (main-loop:threadio ,state) %- (main-loop:threadio ,state)
:~ |=(=state ~(handle-unix-effect core state)) :~ |=(=state ~(handle-unix-effect core state))
|=(=state ~(handle-poke core state)) |=(=state ~(handle-poke core state))
pure:(thread ,state) pure:(thread ,state)
== ==
(pure:m *vase)
:: ::
|_ =state |_ =state
++ handle-unix-effect ++ handle-unix-effect

View File

@ -292,7 +292,7 @@
:: Main :: Main
:: ::
^- imp:spider ^- imp:spider
|= =bowl:spider |= [=bowl:spider args=vase]
=/ m (thread ,vase) =/ m (thread ,vase)
^- form:m ^- form:m
;< ~ bind:m ;< ~ bind:m

View File

@ -1,17 +0,0 @@
/- spider
/+ *threadio
=, thread=thread:libthread
^- imp:spider
|= [=bowl:spider =vase]
=/ m (thread ,vase)
^- form:m
~& > 'starting azt'
=/ url 'http://eth-mainnet.urbit.org:8545'
=/ poke-vase !>([%azimuth-tracker %azimuth-tracker-poke !>([%watch url])])
;< ~ bind:m (poke-our %spider %spider-imput poke-vase)
;< ~ bind:m (watch-our /sub %spider /imp/azimuth-tracker)
|- ^- form:m
=* loop $
;< [=mark =vase] bind:m (take-fact /sub)
%- (slog (sell vase) ~)
loop

View File

@ -15,4 +15,4 @@
;< ~ bind:m (real-ship ~dev) ;< ~ bind:m (real-ship ~dev)
;< ~ bind:m (wait-for-output ~bud "hi ~dev successful") ;< ~ bind:m (wait-for-output ~bud "hi ~dev successful")
;< ~ bind:m end-azimuth ;< ~ bind:m end-azimuth
(pure:m vase) (pure:m *vase)

View File

@ -1,89 +0,0 @@
|* [state=mold in-poke-data=mold sign=mold]
|%
++ agent
=> |%
+$ step (quip move:agent:mall state)
--
$_ ^|
|_ [bowl:mall state]
++ handle-init
*step
::
++ handle-prep
|~ old-state=vase
*step
::
++ handle-poke
|~ =in-poke-data
*step
::
++ handle-peer
|~ path
*step
::
++ handle-pull
|~ path
*step
::
++ handle-peek
|~ path
*(unit (unit cage))
::
++ handle-mall
|~ [wire internal-gift:mall]
*step
::
++ handle-take
|~ [wire =sign]
*step
::
++ handle-lame
|~ [term tang]
*step
--
++ agent-to-mall-agent
|= =a=agent
|^ ^- agent:mall
|_ [=bowl:mall state=vase]
++ handle-init (ag-step handle-init:(ag-core bowl state))
++ handle-prep ((ag-pace ,vase) handle-prep:(ag-core bowl state))
++ handle-poke
|= in=cage
~& poke-in=in
~& !>(*in-poke-data)
=/ data=(unit in-poke-data) !<(in-poke-data q.in)
?~ data
~| [%agent-received-malformed-poke our.bowl dap.bowl]
!!
(ag-step (handle-poke:(ag-core bowl state) u.data))
::
++ handle-peer ((ag-pace ,path) handle-peer:(ag-core bowl state))
++ handle-pull ((ag-pace ,path) handle-pull:(ag-core bowl state))
++ handle-peek handle-peek:(ag-core bowl state)
++ handle-mall
%- (ag-pace ,[wire internal-gift:mall])
handle-mall:(ag-core bowl state)
::
++ handle-take ((ag-pace ,[wire vase]) handle-take:(ag-core bowl state))
++ handle-lame ((ag-pace ,[term tang]) handle-lame:(ag-core bowl state))
--
::
++ ag-core
|= [=bowl:mall =state=vase]
=/ static-state !<(state state-vase)
?~ static-state
~| [%bad-state-type our.bowl dap.bowl]
!!
~(. a-agent bowl u.static-state)
::
++ ag-step
|= =step:agent
[-.step !>(+.step)]
::
++ ag-pace
|* in=mold
|= fun=$-(in step:agent)
|= =in
(ag-step (fun in))
--
--

View File

@ -428,7 +428,7 @@
|= [crash-after=(unit @ud) computation=_*form:(thread (unit result))] |= [crash-after=(unit @ud) computation=_*form:(thread (unit result))]
=/ m (thread ,result) =/ m (thread ,result)
=| try=@ud =| try=@ud
|^ |- ^- form:m |- ^- form:m
=* loop $ =* loop $
?: =(crash-after `try) ?: =(crash-after `try)
(thread-fail %retry-too-many ~) (thread-fail %retry-too-many ~)
@ -449,7 +449,6 @@
%+ add %+ add
(mul ~s1 (bex (dec try))) (mul ~s1 (bex (dec try)))
(mul ~s0..0001 (~(rad og eny) 1.000)) (mul ~s0..0001 (~(rad og eny) 1.000))
--
:: ::
:: ---- :: ----
:: ::

View File

@ -59,7 +59,6 @@
$txt (frond %txt (tape p.sef)) $txt (frond %txt (tape p.sef))
$tan (frond %tan (tape (wush 160 p.sef))) $tan (frond %tan (tape (wush 160 p.sef)))
$det (frond %det json:~(grow mar-sole-change +.sef)) $det (frond %det json:~(grow mar-sole-change +.sef))
$tab (frond %tab a+(turn p.sef |=([=cord tan=^tank] (pairs match+s+cord info+(tape ~(ram re tan)) ~))))
:: ::
$pro $pro
%+ frond %pro %+ frond %pro