PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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. (define-macro (check form)
  6. `(if (not ,form)
  7. (error "Check failed: " ',form)))
  8. (define (=~ a b)
  9. (< (abs (- a b)) 1e-8))
  10. ;; Check first method
  11. (check (=~ (foo 1 2 "bar" 4) 15))
  12. ;; Check second method
  13. (check (=~ (foo 1 2) 4811.4))
  14. (check (=~ (foo 1 2 3.2) 4797.2))
  15. (check (=~ (foo 1 2 3.2 #\Q) 4798.2))
  16. (exit 0)