File: overload_simple_runme_proxy.ss

package info (click to toggle)
renderdoc 1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 79,584 kB
  • sloc: cpp: 491,671; ansic: 285,823; python: 12,617; java: 11,345; cs: 7,181; makefile: 6,703; yacc: 5,682; ruby: 4,648; perl: 3,461; php: 2,119; sh: 2,068; lisp: 1,835; tcl: 1,068; ml: 747; xml: 137
file content (56 lines) | stat: -rw-r--r-- 1,677 bytes parent folder | download | duplicates (14)
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
(load "overload_simple.so")

(define-macro (check test)
  `(if (not ,test) (error ',test)))

(check (string=? (foo) "foo:"))
(check (string=? (foo 3) "foo:int"))
(check (string=? (foo 3.01) "foo:double"))
(check (string=? (foo "hey") "foo:char *"))

(define f (make <Foo>))
(define b (make <Bar>))
(define b2 (make <Bar> 3))

(check (= (slot-ref b 'num) 0))
(check (= (slot-ref b2 'num) 3))

(check (string=? (foo f) "foo:Foo *"))
(check (string=? (foo b) "foo:Bar *"))
(check (string=? (foo f 3) "foo:Foo *,int"))
(check (string=? (foo 3.2 b) "foo:double,Bar *"))

;; now check blah
(check (string=? (blah 2.01) "blah:double"))
(check (string=? (blah "hey") "blah:char *"))

;; now check spam member functions
(define s (make <Spam>))
(define s2 (make <Spam> 3))
(define s3 (make <Spam> 3.2))
(define s4 (make <Spam> "whee"))
(define s5 (make <Spam> f))
(define s6 (make <Spam> b))

(check (string=? (slot-ref s 'type) "none"))
(check (string=? (slot-ref s2 'type) "int"))
(check (string=? (slot-ref s3 'type) "double"))
(check (string=? (slot-ref s4 'type) "char *"))
(check (string=? (slot-ref s5 'type) "Foo *"))
(check (string=? (slot-ref s6 'type) "Bar *"))

;; now check Spam member functions
(check (string=? (foo s 2) "foo:int"))
(check (string=? (foo s 2.1) "foo:double"))
(check (string=? (foo s "hey") "foo:char *"))
(check (string=? (foo s f) "foo:Foo *"))
(check (string=? (foo s b) "foo:Bar *"))

;; check static member funcs
(check (string=? (Spam-bar 3) "bar:int"))
(check (string=? (Spam-bar 3.2) "bar:double"))
(check (string=? (Spam-bar "hey") "bar:char *"))
(check (string=? (Spam-bar f) "bar:Foo *"))
(check (string=? (Spam-bar b) "bar:Bar *"))

(exit 0)