tools.test: less duplication in unit-test~/v~.

modern-harvey2
John Benediktsson 2017-07-25 11:31:30 -07:00
parent 47b45ccad3
commit 154de53470
1 changed files with 5 additions and 4 deletions

View File

@ -66,15 +66,16 @@ SYMBOL: current-test-file
: (unit-test-comparator) ( output input comparator -- error/f failed? tested? )
swapd '[
{ } _ with-datastack
_ >quotation _ compose with-datastack first dup not
{ } _ with-datastack _ >quotation
[ 3dup @ [ 3drop t ] [ drop assert ] if ] compose
with-datastack first dup not
] [ t ] recover t ; inline
: (unit-test~) ( output input -- error/f failed? tested? )
[ 3dup ~ [ 3drop t ] [ drop assert ] if ] (unit-test-comparator) ;
[ ~ ] (unit-test-comparator) ;
: (unit-test-v~) ( output input -- error/f failed? tested? )
[ 3dup v~ [ 3drop t ] [ drop assert ] if ] (unit-test-comparator) ;
[ v~ ] (unit-test-comparator) ;
: short-effect ( effect -- pair )
[ in>> length ] [ out>> length ] bi 2array ;