Add FFI tests for `sizeof' and structs.
authorLudovic Courtès <ludo@gnu.org>
Thu, 11 Nov 2010 15:36:29 +0000 (16:36 +0100)
committerLudovic Courtès <ludo@gnu.org>
Thu, 11 Nov 2010 15:41:15 +0000 (16:41 +0100)
* test-suite/tests/foreign.test ("structs")["sizeof { int8, double }",
  "sizeof { short, int, long, pointer }"]: New tests.

test-suite/tests/foreign.test

index c98d512..59ea6b9 100644 (file)
 \f
 (with-test-prefix "structs"
 
+  (pass-if "sizeof { int8, double }"
+    (= (sizeof (list int8 double))
+       (+ (alignof double) (sizeof double))))
+
+  (pass-if "sizeof { short, int, long, pointer }"
+    (let ((layout (list short int long '*)))
+      (>= (sizeof layout)
+          (reduce + 0.0 (map sizeof layout)))))
+
   (pass-if "parse-c-struct"
     (let ((layout (list int64 uint8))
           (data   (list -300 43)))