File: reference_global_vars.scm

package info (click to toggle)
swig 4.1.0-0.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 47,992 kB
  • sloc: cpp: 50,555; ansic: 27,840; java: 15,366; python: 11,221; cs: 8,852; ruby: 6,307; yacc: 6,290; makefile: 5,702; sh: 5,492; perl: 3,818; php: 3,046; ml: 2,094; lisp: 1,756; javascript: 1,751; tcl: 1,499; xml: 115
file content (67 lines) | stat: -rw-r--r-- 2,352 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(define (!= a b) (not (= a b)))

; const class reference variable
(if (!= (TestClass-num-get (getconstTC)) 33)
  (begin (display "Runtime test 1 failed.\n") (exit 1)))

; primitive reference variables
(var-bool (createref-bool #f))
(if (value-bool (var-bool))
  (begin (display "Runtime test 2 failed.\n") (exit 1)))

(var-char (createref-char #\w))
(if (not (char=? (value-char (var-char)) #\w))
  (begin (display "Runtime test 3 failed.\n") (exit 1)))

(var-unsigned-char (createref-unsigned-char #\newline))
(if (not (char=? (value-unsigned-char (var-unsigned-char)) #\newline))
  (begin (display "Runtime test 4 failed.\n") (exit 1)))

(var-signed-char (createref-signed-char #\newline))
(if (not (char=? (value-signed-char (var-signed-char)) #\newline))
  (begin (display "Runtime test 5 failed.\n") (exit 1)))

(var-unsigned-short (createref-unsigned-short 10))
(if (!= (value-unsigned-short (var-unsigned-short)) 10)
  (begin (display "Runtime test 6 failed.\n") (exit 1)))

(var-int (createref-int 10))
(if (!= (value-int (var-int)) 10)
  (begin (display "Runtime test 7 failed.\n") (exit 1)))

(var-unsigned-int (createref-unsigned-int 10))
(if (!= (value-unsigned-int (var-unsigned-int)) 10)
  (begin (display "Runtime test 8 failed.\n") (exit 1)))

(var-long (createref-long 10))
(if (!= (value-long (var-long)) 10)
  (begin (display "Runtime test 9 failed.\n") (exit 1)))

(var-unsigned-long (createref-unsigned-long 10))
(if (!= (value-unsigned-long (var-unsigned-long)) 10)
  (begin (display "Runtime test 10 failed.\n") (exit 1)))

;skip long long and unsigned long long

(var-float (createref-float 10.5))
(if (!= (value-float (var-float)) 10.5)
  (begin (display "Runtime test 11 failed.\n") (exit 1)))

(var-double (createref-double 10.55))
(if (!= (value-double (var-double)) 10.55)
  (begin (display "Runtime test 12 failed.\n") (exit 1)))

;class reference
(var-TestClass (createref-TestClass (new-TestClass 20)))
(if (!= (TestClass-num-get (value-TestClass (var-TestClass))) 20)
  (begin (display "Runtime test 13 failed.\n") (exit 1)))

; Test garbage collection on guile >= 2.0.12
(if (or (and (string=? (major-version) "2")
             (string=? (minor-version) "0")
             (string>=? (micro-version) "12"))
        (and (string>=? (major-version) "2")
             (string>=? (minor-version) "1")))
    (gc))

(exit 0)