;;;; ;;;; test-ffi.stk -- Tests of FFI ;;;; ;;;; Copyright © 2007-2009 Erick Gallesio - I3S-CNRS/ESSI ;;;; ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by ;;;; the Free Software Foundation; either version 2 of the License, or ;;;; (at your option) any later version. ;;;; ;;;; This program is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;;; GNU General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU General Public License ;;;; along with this program; if not, write to the Free Software ;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, ;;;; USA. ;;;; ;;;; Author: Erick Gallesio [eg@essi.fr] ;;;; Creation date: 26-Sep-2009 10:17 (eg) ;;;; Last file update: 26-Sep-2009 10:59 (eg) ;;;; (require "test") (test-section "FFI") ;;; RINDEX (define-external %rindex (:string :int) :entry-name "rindex" :return-type :string) (define (rindex str char) (%rindex str (char->integer char))) ;;; STRLEN (define-external strlen(:string) :return-type :int) (test "rindex.1" "/d" (rindex "/a/b/c/d" #\/)) (test "rindex.2" (void) (rindex "/a/b/c/d" #\A)) (test "strlen.1" 0 (strlen "")) (test "strlen.2" 5 (strlen "abcde")) (test-section-end)