PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/guile/overload_complicated_runme.scm

#
Lisp | 21 lines | 11 code | 5 blank | 5 comment | 0 complexity | bec42ff8dd5dff77668f8af9fbfe4e35 MD5 | raw file
 1;; The SWIG modules have "passive" Linkage, i.e., they don't generate
 2;; Guile modules (namespaces) but simply put all the bindings into the
 3;; current module.  That's enough for such a simple test.
 4(dynamic-call "scm_init_overload_complicated_module" (dynamic-link "./liboverload_complicated.so"))
 5
 6(define-macro (check form)
 7  `(if (not ,form)
 8       (error "Check failed: " ',form)))
 9
10(define (=~ a b)
11  (< (abs (- a b)) 1e-8))
12
13;; Check first method
14(check (=~ (foo 1 2 "bar" 4) 15))
15
16;; Check second method
17(check (=~ (foo 1 2) 4811.4))
18(check (=~ (foo 1 2 3.2) 4797.2))
19(check (=~ (foo 1 2 3.2 #\Q) 4798.2))
20
21(exit 0)