2018-08-29 01:02:53 +03:00
|
|
|
/+ tester
|
|
|
|
::
|
|
|
|
/= clay-raw /: /===/sys/vane/clay /!noun/
|
|
|
|
::
|
|
|
|
!:
|
|
|
|
=, format
|
|
|
|
::
|
|
|
|
=/ test-pit=vase !>(..zuse)
|
|
|
|
=/ clay-gate (clay-raw test-pit)
|
|
|
|
::
|
|
|
|
|_ _tester:tester
|
|
|
|
++ test-info ^- tang
|
|
|
|
::
|
|
|
|
=^ results1 clay-gate
|
|
|
|
%- clay-call-with-comparator :*
|
|
|
|
clay-gate
|
|
|
|
now=~1111.1.1
|
|
|
|
scry=*sley
|
|
|
|
^= call-args
|
|
|
|
:+ duct=~[/info] type=-:!>(*task:able:clay)
|
|
|
|
^- task:able:clay
|
|
|
|
:^ %info ~nul %home
|
|
|
|
^- nori:clay
|
|
|
|
:- %&
|
|
|
|
^- soba:clay
|
|
|
|
:~ [/file1/noun `miso:clay`[%ins [%noun %noun 'file1']]]
|
|
|
|
[/file2/noun `miso:clay`[%ins [%noun %noun 'file2']]]
|
|
|
|
==
|
|
|
|
^= move-comparator
|
|
|
|
|= moves=(list move:clay-gate)
|
|
|
|
^- tang
|
|
|
|
::
|
|
|
|
?. ?=([* * * ~] moves)
|
|
|
|
[%leaf "wrong number of moves: {<(lent moves)>}"]~
|
|
|
|
::
|
|
|
|
^- tang
|
2018-08-29 01:11:24 +03:00
|
|
|
;: weld
|
2018-08-29 21:03:26 +03:00
|
|
|
%+ expect-nu-eq
|
|
|
|
!> ^- move:clay-gate
|
|
|
|
:- duct=~[/info]
|
|
|
|
^- (wind note:clay-gate gift:able:clay)
|
|
|
|
:+ %pass /castifying/~nul/home/~1111.1.1
|
|
|
|
^- note:clay-gate
|
|
|
|
:- %f
|
|
|
|
[%build ~nul live=%.n [%pin ~1111.1.1 [%list ~]]]
|
|
|
|
!> i.moves
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
2018-08-29 21:03:26 +03:00
|
|
|
%+ expect-nu-eq
|
|
|
|
!> ^- move:clay-gate
|
|
|
|
:- duct=~[/info]
|
|
|
|
^- (wind note:clay-gate gift:able:clay)
|
|
|
|
:+ %pass /diffing/~nul/home/~1111.1.1
|
|
|
|
^- note:clay-gate
|
|
|
|
:- %f
|
|
|
|
[%build ~nul live=%.n [%pin ~1111.1.1 [%list ~]]]
|
|
|
|
!> i.t.moves
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
^- tang
|
|
|
|
::
|
|
|
|
=/ move=move:clay-gate i.t.t.moves
|
|
|
|
=/ =duct p.move
|
|
|
|
=/ card=(wind note:clay-gate gift:able:clay) q.move
|
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>(~[/info]) !>(duct))
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
?. ?=(%pass -.card)
|
|
|
|
[%leaf "bad move, not a %pass: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ =wire p.card
|
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>(/inserting/~nul/home/~1111.1.1) !>(wire))
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
=/ note=note:clay-gate q.card
|
|
|
|
::
|
|
|
|
?. ?=([%f %build *] note)
|
|
|
|
[%leaf "bad move, not a %build: {<move>}"]~
|
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>(~nul) !>(our.note))
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>(%.n) !>(live.note))
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
?. ?=(%pin -.schematic.note)
|
|
|
|
[%leaf "bad move, not a %pin: {<move>}"]~
|
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>(~1111.1.1) !>(date.schematic.note))
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
=/ list-schematic=schematic:ford schematic.schematic.note
|
|
|
|
::
|
|
|
|
?. ?=(%list -.list-schematic)
|
|
|
|
[%leaf "bad move, not a %list: {<move>}"]~
|
|
|
|
::
|
|
|
|
?. ?=([* * ~] schematics.list-schematic)
|
|
|
|
[%leaf "bad move, wrong number of sub-schematics: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ s1=schematic:ford i.schematics.list-schematic
|
|
|
|
=/ s2=schematic:ford i.t.schematics.list-schematic
|
|
|
|
:: test :s1
|
|
|
|
::
|
|
|
|
?. ?=([^ *] s1)
|
|
|
|
[%leaf "bad move, s1 not cell: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ path1=schematic:ford -.s1
|
|
|
|
?. ?=([%$ %path *] path1)
|
|
|
|
[%leaf "bad move, path1 not %path: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ vase1=vase q.literal.path1
|
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>([-:!>(*path) /file1/noun]) !>(vase1))
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
=/ cast1=schematic:ford +.s1
|
|
|
|
::
|
|
|
|
?. ?=([%cast [%~nul %home] %noun *] cast1)
|
|
|
|
[%leaf "bad move, wrong cast1: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ lit1=schematic:ford input.cast1
|
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>([%$ %noun %noun 'file1']) !>(lit1))
|
2018-08-29 01:02:53 +03:00
|
|
|
:: test :s2
|
|
|
|
::
|
|
|
|
?. ?=([^ *] s2)
|
|
|
|
[%leaf "bad move, s2 not cell: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ path2=schematic:ford -.s2
|
|
|
|
?. ?=([%$ %path *] path2)
|
|
|
|
[%leaf "bad move, path2 not %path: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ vase2=vase q.literal.path2
|
|
|
|
::
|
2018-08-29 01:11:24 +03:00
|
|
|
%+ weld
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>([-:!>(*path) /file2/noun]) !>(vase2))
|
2018-08-29 01:02:53 +03:00
|
|
|
::
|
|
|
|
=/ cast2=schematic:ford +.s2
|
|
|
|
::
|
|
|
|
?. ?=([%cast [%~nul %home] %noun *] cast2)
|
|
|
|
[%leaf "bad move, wrong cast2: {<move>}"]~
|
|
|
|
::
|
|
|
|
=/ lit2=schematic:ford input.cast2
|
|
|
|
::
|
2018-08-29 21:03:26 +03:00
|
|
|
(expect-nu-eq !>([%$ %noun %noun 'file2']) !>(lit2))
|
2018-08-29 01:02:53 +03:00
|
|
|
== ==
|
|
|
|
::
|
|
|
|
;: welp
|
|
|
|
results1
|
|
|
|
==
|
|
|
|
:: |utilities: helper functions for testing
|
|
|
|
::
|
|
|
|
::+| utilities
|
|
|
|
::
|
|
|
|
:: +clay-call: have clay run a +task and assert it produces :expected-moves7890
|
|
|
|
::
|
|
|
|
:: TODO: make this generic for any vane
|
|
|
|
::
|
|
|
|
++ clay-call
|
|
|
|
|= $: clay-gate=_clay-gate
|
|
|
|
now=@da
|
|
|
|
scry=sley
|
|
|
|
call-args=[=duct =type wrapped-task=(hobo task:able:clay)]
|
|
|
|
expected-moves=(list move:clay-gate)
|
|
|
|
==
|
|
|
|
^- [tang _clay-gate]
|
|
|
|
::
|
|
|
|
=/ clay-core (clay-gate now=now eny=0xdead.beef scry=scry)
|
|
|
|
::
|
|
|
|
=^ moves clay-gate (call:clay-core call-args)
|
|
|
|
::
|
|
|
|
=/ output=tang
|
|
|
|
%- expect-eq !>
|
|
|
|
:- expected-moves
|
|
|
|
moves
|
|
|
|
::
|
|
|
|
[output clay-gate]
|
|
|
|
:: +clay-call-with-comparator: run a clay +task and test output moves
|
|
|
|
::
|
|
|
|
:: TODO: make this generic for any vane
|
|
|
|
::
|
|
|
|
++ clay-call-with-comparator
|
|
|
|
|= $: clay-gate=_clay-gate
|
|
|
|
now=@da
|
|
|
|
scry=sley
|
|
|
|
call-args=[=duct =type wrapped-task=(hobo task:able:clay)]
|
|
|
|
move-comparator=$-((list move:clay-gate) tang)
|
|
|
|
==
|
|
|
|
^- [tang _clay-gate]
|
|
|
|
::
|
|
|
|
=/ clay-core (clay-gate now=now eny=0xdead.beef scry=scry)
|
|
|
|
::
|
|
|
|
=^ moves clay-gate (call:clay-core call-args)
|
|
|
|
::
|
|
|
|
=/ output=tang (move-comparator moves)
|
|
|
|
::
|
|
|
|
[output clay-gate]
|
|
|
|
--
|