#lang scheme (require (prefix-in my: "main.ss")) (require scheme/foreign) (require (planet schematics/schemeunit)) (define cases `(("short integer" ,_int8 "int8_t" #t) ("unsigned short integer" ,_uint8 "uint8_t" #f) ("integer" ,_int16 "int16_t" #t) ("unsigned integer" ,_uint16 "int16_t" #f) ("long integer" ,_int32 "int32_t" #t) ("unsigned long integer" ,_uint32 "uint32_t" #f) ("long long integer" ,_int64 "int64_t" #t) ("unsigned long long integer" ,_uint64 "uint64_t" #f))) (define tests (test-suite "sizeof" (for-each (λ (case) (let-values ([(test-name c-type type-name signed?) (apply values case)]) (test-case test-name (check-equal? (ctype-sizeof c-type) (my:sizeof type-name "stdint")) (check-equal? c-type (my:pick-an-integer type-name signed?))))) cases)))