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

« back to all changes in this revision

Viewing changes to testsuite/struct_in_union-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 struct_in_union 
 
3
;;; 
 
4
 
 
5
(use gauche.test)
 
6
 
 
7
(test-start "struct_in_union")
 
8
(use c-wrapper)
 
9
(test-module 'c-wrapper)
 
10
 
 
11
(c-include "./struct_in_union.h")
 
12
 
 
13
(test "reference"
 
14
      0
 
15
      (lambda ()
 
16
        (ref (ref (ref (make <c-struct:struct_in_union>) 'u) 's1) 'v1)))
 
17
 
 
18
(test "set"
 
19
      1
 
20
      (lambda ()
 
21
        (let ((struct (make <c-struct:struct_in_union>)))
 
22
          (set! (ref (ref (ref struct 'u) 's1) 'v1) 1)
 
23
          (ref (ref (ref struct 'u) 's1) 'v1))))
 
24
 
 
25
(test "a union in an array"
 
26
      2
 
27
      (lambda ()
 
28
        (let ((array (make (<c-struct:struct_in_union> 3))))
 
29
          (set! (ref (ref (ref (ref array 1) 'u) 's1) 'v1) 2)
 
30
          (ref (ref (ref (ref array 1) 'u) 's1) 'v1))))
 
31
 
 
32
;; epilogue
 
33
(test-end)
 
34