X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fgettime.cl;h=c562fade74e514648dace5c253ed1d531a32c08c;hb=acdc714a0b8ea9c0df0c9ffc56699fa010bd549e;hp=12012565ffc9f5d827ad09da169021d934c9edbe;hpb=bf5c7e7c36474375604bcbcedea8794a68dd1784;p=uffi.git diff --git a/tests/gettime.cl b/tests/gettime.cl index 1201256..c562fad 100644 --- a/tests/gettime.cl +++ b/tests/gettime.cl @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: gettime.cl,v 1.6 2002/03/14 21:03:12 kevin Exp $ +;;;; $Id: gettime.cl,v 1.9 2002/04/02 23:27:05 kevin Exp $ ;;;; ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -44,8 +44,8 @@ (defun gettime () "Returns the local time" - (let* ((time (uffi:allocate-foreign-object time-t))) - (declare (type time-t time)) + (uffi:with-foreign-object (time 'time-t) +;; (declare (type time-t time)) (c-time time) (let ((tm-ptr (the tm-pointer (c-localtime time)))) (declare (type tm-pointer tm-ptr)) @@ -57,14 +57,20 @@ (uffi:get-slot-value tm-ptr 'tm 'min) (uffi:get-slot-value tm-ptr 'tm 'sec) ))) - (uffi:free-foreign-object time) - time-string)) - )) + time-string)))) -#+test-uffi +#+examples-uffi (format t "~&~A" (gettime)) +#+test-uffi +(progn + (let ((time (gettime))) + (util.test:test (stringp time) t :fail-info "Time is not a string") + (util.test:test (plusp (parse-integer time :junk-allowed t)) + t + :fail-info "time string does not start with a number"))) +