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