alarms: add a couple of unit tests

db4
Slava Pestov 2010-05-21 19:09:01 -04:00
parent 01e14d1430
commit 0e496c8693
1 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,6 @@
USING: alarms alarms.private kernel calendar sequences
tools.test threads concurrency.count-downs ;
tools.test threads concurrency.count-downs concurrency.promises
fry tools.time math ;
IN: alarms.tests
[ ] [
@ -14,3 +15,17 @@ IN: alarms.tests
self [ resume ] curry instant later drop
"test" suspend drop
] unit-test
[ t ] [
[
<promise>
'[ t _ fulfill ] 5 seconds later drop
] benchmark 4,000,000,000 >
] unit-test
[ { 3 } ] [
{ 3 } dup
'[ 4 _ set-first ] 2 seconds later
1/2 seconds sleep
cancel-alarm
] unit-test