ffi-binding-check.scm 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Harald Glab-Plhak
  3. ;; test for the new ffi
  4. (define-test-suite ffi-binding-tests )
  5. ;; test a simple insert with two bindings
  6. (define-test-case ffi-export-bind-test-case ffi-binding-tests
  7. (check
  8. (let ((my-rec (ffi-make-a-record "test-id")))
  9. (list (a-record-id my-rec) (a-record-type my-rec) (a-record-value my-rec)) )
  10. => (list "test-id" "type" "a-value")))
  11. (define-test-case ffi-import-bind-test-case ffi-binding-tests
  12. (check
  13. (let ((the-binding (ffi-get-imp-binding "a-status")))
  14. (let ((bind-value (ffi-get-imp-value-by-binding the-binding)))
  15. bind-value))
  16. => 80))
  17. (define-test-case ffi-bind-test-with-direct-param ffi-binding-tests
  18. (check
  19. (let ((the-binding (ffi-get-imp-binding "a-status")))
  20. (ffi-a-status-set-by-binding! 70)
  21. (let ((bind-value (ffi-get-imp-value-by-binding the-binding)))
  22. (equal? bind-value (ffi-a-status))))))
  23. (define-test-case ffi-bind-check-and-get-name ffi-binding-tests
  24. (check
  25. (let ((bind-name "a-status"))
  26. (equal? bind-name (ffi-check-a-status-and-get-name)))))