-;;; On x86 This'll signal a TYPE-ERROR "The value -2147483649 is not of type
-;;; (SIGNED-BYTE 32)". On x86-64 it'll wrap around to 2147483647, probably
-;;; due to the sign-extension done by the (INTEGER :NATURALIZE-GEN)
-;;; alien-type-method. I believe the former behaviour is the one we want.
-;;; -- JES, 2005-10-16
+(with-test (:name (:short-result :sign-extension))
+ (assert (= (alien-funcall *add-two-shorts* #x-8000 1) -32767)))
+
+(with-test (:name (:short-result :underflow-detection))
+ (assert (raises-error? (alien-funcall *add-two-shorts* #x-8000 -1))))
+
+(with-test (:name (:int-result :sign-extension))
+ (assert (= (alien-funcall *add-two-ints* #x-80000000 1) -2147483647)))