~ubuntu-branches/ubuntu/lucid/gauche-c-wrapper/lucid

« back to all changes in this revision

Viewing changes to testsuite/gcc_extension-test.scm

  • Committer: Bazaar Package Importer
  • Author(s): NIIBE Yutaka
  • Date: 2008-04-07 09:15:03 UTC
  • Revision ID: james.westby@ubuntu.com-20080407091503-wu0h414koe95kj4i
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;;;
 
2
;;; Test GCC extension
 
3
;;; 
 
4
 
 
5
(use gauche.test)
 
6
 
 
7
(test-start "gcc_extension")
 
8
(use c-wrapper)
 
9
(test-module 'c-wrapper)
 
10
 
 
11
(c-load-library "./gcc_extension")
 
12
(c-include "./gcc_extension.h")
 
13
 
 
14
(test "Unnamed struct/union fields within structs/unions 1"
 
15
      '(2 3.0 4 5 6.0)
 
16
      (lambda ()
 
17
        (let ((foo (make (c-struct 'foo))))
 
18
          (set! (ref foo 'a) 1)
 
19
          (set! (ref foo 'b) 2)
 
20
          (set! (ref foo 'e) 3)
 
21
          (set! (ref foo 'f) 4)
 
22
          (set! (ref foo 'g) 5)
 
23
          (inc_foo (ptr foo) FLOAT_MODE)
 
24
          (map (cut ref foo <>) '(a b e f g)))))
 
25
 
 
26
(test "Unnamed struct/union fields within structs/unions 2"
 
27
      '(2 3 4.0 5 6 7.0)
 
28
      (lambda ()
 
29
        (let ((foo (make (c-struct 'foo))))
 
30
          (set! (ref foo 'a) 1)
 
31
          (set! (ref foo 'c) 2)
 
32
          (set! (ref foo 'd) 3)
 
33
          (set! (ref foo 'e) 4)
 
34
          (set! (ref foo 'f) 5)
 
35
          (set! (ref foo 'g) 6)
 
36
          (inc_foo (ptr foo) STRUCT_MODE)
 
37
          (map (cut ref foo <>) '(a c d e f g)))))
 
38
 
 
39
;; epilogue
 
40
(test-end)