X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Fstrtol.lisp;h=b9b73bd805410ff22f7eb92723ce17ee2b39b1bd;hb=7004c2691d5695471c7bce9d62b82a1914cf05a2;hp=c2956e37363f004e7170fb00a35a50c752e2e3f8;hpb=a95b9a217335917d96b8c0cced4f49c3e4846115;p=uffi.git diff --git a/tests/strtol.lisp b/tests/strtol.lisp index c2956e3..b9b73bd 100644 --- a/tests/strtol.lisp +++ b/tests/strtol.lisp @@ -2,21 +2,18 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: strtol.cl +;;;; Name: strtol.lisp ;;;; Purpose: UFFI Example file to strtol, uses pointer arithmetic ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: strtol.lisp,v 1.1 2002/09/30 10:02:36 kevin Exp $ +;;;; $Id$ ;;;; -;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; This file, part of UFFI, is Copyright (c) 2002-2003 by Kevin M. Rosenberg ;;;; -;;;; UFFI users are granted the rights to distribute and use this software -;;;; as governed by the terms of the Lisp Lesser GNU Public License -;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. ;;;; ************************************************************************* -(in-package :cl-user) +(in-package #:uffi-tests) (uffi:def-foreign-type char-ptr (* :unsigned-char)) @@ -28,6 +25,7 @@ ((nptr char-ptr) (endptr (* char-ptr)) (base :int)) + :module "c" :returning :long) (defun strtol (str &optional (base 10)) @@ -57,27 +55,11 @@ of first non-valid character" (uffi:free-foreign-object str-native) (uffi:free-foreign-object endptr))))) - - -#+examples-uffi -(progn - (flet ((print-results (str) - (multiple-value-bind (result flag) (strtol str) - (format t "~&(strtol ~S) => ~S,~S" str result flag)))) - (print-results "55") - (print-results "55.3") - (print-results "a"))) +(deftest strtol.1 (strtol "123") 123 t) +(deftest strtol.2 (strtol "0") 0 t) +(deftest strtol.3 (strtol "55a") 55 2) +(deftest strtol.4 (strtol "a") nil nil) -#+test-uffi -(progn - (flet ((test-strtol (str results) - (util.test:test (multiple-value-list (strtol str)) results - :test #'equal - :fail-info "Error testing strtol"))) - (test-strtol "123" '(123 t)) - (test-strtol "0" '(0 t)) - (test-strtol "55a" '(55 2)) - (test-strtol "a" '(nil nil))))