factor/library/tools/test.facts

34 lines
1.9 KiB
Plaintext
Raw Normal View History

2006-03-25 01:06:52 -05:00
IN: test
USING: help kernel ;
2006-08-16 21:55:53 -04:00
HELP: assert
2006-08-01 17:35:00 -04:00
{ $values { "got" "the obtained value" } { "expect" "the expected value" } }
{ $description "Throws an " { $link assert } " error." }
{ $error-description "Thrown when a unit test or other assertion fails." }
{ $see-also unit-test unit-test-fails assert-depth } ;
2006-08-16 21:55:53 -04:00
HELP: benchmark
2006-03-25 01:06:52 -05:00
{ $values { "quot" "a quotation" } { "gctime" "an integer denoting milliseconds" } { "runtime" "an integer denoting milliseconds" } }
{ $description "Runs a quotation, measuring the total wall clock time and the total time spent in the garbage collector." }
{ $notes "A nicer word for interactive use is " { $link time } "." } ;
2006-08-16 21:55:53 -04:00
HELP: time
2006-03-25 01:06:52 -05:00
{ $values { "quot" "a quotation" } }
{ $description "Runs a quotation and then prints the total run time and time spent in the garbage collector." }
{ $examples
{ $example "[ 1000000 0 [ + ] reduce drop ] time" "1116 ms run / 6 ms GC time" }
} ;
2006-08-16 21:55:53 -04:00
HELP: unit-test
2006-03-25 01:06:52 -05:00
{ $values { "output" "a sequence of expected stack elements" } { "input" "a quotation run with an empty stack" } }
{ $description "Runs a quotation with an empty stack, comparing the resulting stack with " { $snippet "output" } ". Elements are compared using " { $link = } ". Throws an error if the expected stack does not match the resulting stack." } ;
2006-08-16 21:55:53 -04:00
HELP: unit-test-fails
2006-03-25 01:06:52 -05:00
{ $values { "quot" "a quotation run with an empty stack" } }
{ $description "Runs a quotation with an empty stack, expecting it to throw an error. If the quotation throws an error, this word returns normally. If the quotation does not throw an error, this word " { $emphasis "does" } " raise an error." }
{ $notes "This word is used to test boundary conditions and fail-fast behavior." } ;
2006-08-16 21:55:53 -04:00
HELP: assert-depth
2006-03-25 01:06:52 -05:00
{ $values { "quot" "a quotation" } }
{ $description "Runs a quotation. Throws an error if the total number of elements on the stack is not the same before and after the quotation runs." } ;