File: gcc_extension-test.scm

package info (click to toggle)
gauche-c-wrapper 0.6.1-18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,440 kB
  • sloc: ansic: 17,899; sh: 14,025; asm: 6,456; lisp: 5,485; yacc: 2,109; makefile: 520; exp: 194; cpp: 157; objc: 144; perl: 2
file content (40 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download | duplicates (8)
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
32
33
34
35
36
37
38
39
40
;;;
;;; Test GCC extension
;;; 

(use gauche.test)

(test-start "gcc_extension")
(use c-wrapper)
(test-module 'c-wrapper)

(c-load-library "./gcc_extension")
(c-include "./gcc_extension.h")

(test "Unnamed struct/union fields within structs/unions 1"
      '(2 3.0 4 5 6.0)
      (lambda ()
        (let ((foo (make (c-struct 'foo))))
          (set! (ref foo 'a) 1)
          (set! (ref foo 'b) 2)
          (set! (ref foo 'e) 3)
          (set! (ref foo 'f) 4)
          (set! (ref foo 'g) 5)
          (inc_foo (ptr foo) FLOAT_MODE)
          (map (cut ref foo <>) '(a b e f g)))))

(test "Unnamed struct/union fields within structs/unions 2"
      '(2 3 4.0 5 6 7.0)
      (lambda ()
        (let ((foo (make (c-struct 'foo))))
          (set! (ref foo 'a) 1)
          (set! (ref foo 'c) 2)
          (set! (ref foo 'd) 3)
          (set! (ref foo 'e) 4)
          (set! (ref foo 'f) 5)
          (set! (ref foo 'g) 6)
          (inc_foo (ptr foo) STRUCT_MODE)
          (map (cut ref foo <>) '(a c d e f g)))))

;; epilogue
(test-end)