r9330: add tests
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 13 May 2004 04:34:44 +0000 (04:34 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 13 May 2004 04:34:44 +0000 (04:34 +0000)
tests/foreign-loader.lisp
tests/uffi-c-test-lib.lisp
tests/uffi-c-test.c

index ac9b5c04615f2a61c93ec5f470c3e788d911136d..c0548c1218b98bab89c8df00c61b8d72821aea90 100644 (file)
@@ -25,7 +25,8 @@
          #+(or macosx darwin)
          "z"
          (list (pathname-directory *load-pathname*)
-               "/usr/local/lib/" "/usr/lib/" "/zlib/"))
+               "/usr/local/lib/" #+64bit "/usr/lib64/" 
+               "/zlib/"))
         :module "zlib" 
         :supporting-libraries '("c"))
   (warn "Unable to load zlib"))
index 14bca3178efc7cd7a38d173d823922ec96e77b65..95b411e53a05aec48be467d9bc3b4dd56132d1ad 100644 (file)
 
 (uffi:def-function ("cs_count_upper" cs-count-upper)
   ((input :cstring))
-  :returning :int
-  )
+  :returning :int)
 
 (defun string-count-upper (str)
   (uffi:with-cstring (str-cstring str)
-    (cs-count-upper str-cstring)))
+    (cs-count-upper str-cstring))) 
 
 (uffi:def-function ("half_double_vector" half-double-vector)
     ((size :int)
      (vec (* :double)))
   :returning :void)
 
+(uffi:def-function ("return_long_negative_one" return-long-negative-one)
+    ()
+  :returning :long)
+
+(uffi:def-function ("return_int_negative_one" return-int-negative-one)
+    ()
+  :returning :int)
+
+(uffi:def-function ("return_short_negative_one" return-short-negative-one)
+    ()
+  :returning :short)
+
 (uffi:def-constant +double-vec-length+ 10)
 (defun test-half-double-vector ()
   (let ((vec (uffi:allocate-foreign-object :double +double-vec-length+))
@@ -75,4 +86,7 @@
 (deftest c-test.4 (string-count-upper nil) -1)
 (deftest c-test.5 (test-half-double-vector)
   (0.0d0 0.5d0 1.0d0 1.5d0 2.0d0 2.5d0 3.0d0 3.5d0 4.0d0 4.5d0))
+(deftest c-test.6 (return-long-negative-one) -1)
+(deftest c-test.7 (return-int-negative-one) -1)
+(deftest c-test.8 (return-short-negative-one) -1)
 
index ee1ab3a3f6fd6ddd542c3b65a823223285dc2a54..1e9ef0b691e29b1e968ef976fdd2102b82fe14fe 100644 (file)
@@ -119,6 +119,27 @@ cast_test_float ()
   return y;
 }
 
+DLLEXPORT
+long
+return_long_negative_one ()
+{
+  return -1;
+}
+
+DLLEXPORT
+int
+return_int_negative_one ()
+{
+  return -1;
+}
+
+DLLEXPORT
+short
+return_short_negative_one ()
+{
+  return -1;
+}
+
 DLLEXPORT int fvar_addend = 3;
 
 typedef struct {