Skip to content

Commit

Permalink
Keep timestamps off stack (codewars#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Keldan Chapman committed Aug 25, 2023
1 parent d02180e commit cc804bf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tools/testest/testest.factor
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ io io.streams.string io.styles kernel locals math namespaces parser prettyprint
prettyprint.config prettyprint.custom quotations sequences splitting system ;
IN: tools.testest

: describe#{ ( description -- starttime ) nl "<DESCRIBE::>%s" printf nl flush nano-count ;
: it#{ ( description -- starttime ) nl "<IT::>%s" printf nl flush nano-count ;
: }# ( starttime -- ) nano-count swap - 1000000 / nl "<COMPLETEDIN::>%f ms" printf nl ;
DEFER: }# delimiter
: timed-block ( accum tag -- accum )
\ }# parse-until >quotation '[
nl _ printf nl flush nano-count _ dip
nano-count swap - 1000000 / nl "<COMPLETEDIN::>%f ms" printf nl
] append! ;

SYNTAX: describe#{ "<DESCRIBE::>%s" timed-block ;
SYNTAX: it#{ "<IT::>%s" timed-block ;


! user redefinable test result message quotations

Expand Down

0 comments on commit cc804bf

Please sign in to comment.