File: ffi-aggregates-check.scm

package info (click to toggle)
scheme48 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 18,232 kB
  • sloc: lisp: 88,907; ansic: 87,519; sh: 3,224; makefile: 771
file content (31 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
; Part of Scheme 48 1.9.  See file COPYING for notices and license.

; Authors: Harald Glab-Plhak,

;; test for the new ffi

(define-record-type any-record :any-record
  (make-any-record id name address)
  any-record?
  (id any-record-id)
  (name any-record-name)
  (address any-record-address))

(define-test-suite  ffi-aggregates-tests )

(define-test-case ffi-make-set-refrec/vect ffi-aggregates-tests
  (check 
   (let ((my-rec (make-any-record 10 'Hans 'ZurSchnecke)))
     (ffi-record-set! my-rec 1 'Hugo)
     (let ((result (ffi-make-vector 3 0)))
       (ffi-vector-set! result 0 (any-record-id my-rec))
       (ffi-vector-set! result 1 (ffi-record-ref my-rec 1))
       (ffi-vector-set! result 2 (ffi-record-ref my-rec 2))
       (list (any-record-id my-rec) result)))
   => '(10 #(10 Hugo ZurSchnecke))))

(define-test-case enum-set-test ffi-aggregates-tests
  (check 
   (let ((col-enum-set (ffi-get-color-enum-set 3)))
     (ffi-enums col-enum-set))
   => 3))