From 0ba2c964af790e9713e7836a7c4eac2c6c7100ae Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 02:18:50 -0600 Subject: [PATCH] Remove obsolete file, add unit tests for core-foundation.run-loop, add word --- basis/core-foundation/core-foundation-tests.factor | 9 --------- basis/core-foundation/timers/timers.factor | 7 +++++-- .../io/unix/multiplexers/run-loop/run-loop-tests.factor | 5 +++++ 3 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 basis/core-foundation/core-foundation-tests.factor create mode 100644 basis/io/unix/multiplexers/run-loop/run-loop-tests.factor diff --git a/basis/core-foundation/core-foundation-tests.factor b/basis/core-foundation/core-foundation-tests.factor deleted file mode 100644 index c1d6788d50..0000000000 --- a/basis/core-foundation/core-foundation-tests.factor +++ /dev/null @@ -1,9 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: core-foundation tools.test kernel ; -IN: core-foundation - -[ ] [ "Hello" CFRelease ] unit-test -[ "Hello" ] [ "Hello" [ CF>string ] [ CFRelease ] bi ] unit-test -[ "Hello\u003456" ] [ "Hello\u003456" [ CF>string ] [ CFRelease ] bi ] unit-test -[ "Hello\u013456" ] [ "Hello\u013456" [ CF>string ] [ CFRelease ] bi ] unit-test diff --git a/basis/core-foundation/timers/timers.factor b/basis/core-foundation/timers/timers.factor index eddeb87d1d..1d17d99a4d 100644 --- a/basis/core-foundation/timers/timers.factor +++ b/basis/core-foundation/timers/timers.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax ; +USING: alien.syntax system math kernel ; IN: core-foundation.timers TYPEDEF: void* CFRunLoopTimerRef @@ -17,9 +17,12 @@ FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate ( CFRunLoopTimerContext* context ) ; +: ( callback -- timer ) + [ f millis 1000 /f 60 0 0 ] dip f CFRunLoopTimerCreate ; + FUNCTION: void CFRunLoopTimerInvalidate ( CFRunLoopTimerRef timer -); +) ; FUNCTION: void CFRunLoopTimerSetNextFireDate ( CFRunLoopTimerRef timer, diff --git a/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor b/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor new file mode 100644 index 0000000000..5f249c6881 --- /dev/null +++ b/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor @@ -0,0 +1,5 @@ +USING: io.unix.multiplexers.run-loop tools.test +destructors ; +IN: io.unix.multiplexers.run-loop.tests + +[ ] [ dispose ] unit-test