#! /bin/sh
exec ../src/sizzle -qs $0 $*
!#
;; test/dynload.scm -- tests for the dynamic loading functions
;;
;; Copyright (C) 2000 Martin Grabmueller <mgrabmue@cs.tu-berlin.de>
;;
;; This is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; 
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; 
;; You should have received a copy of the GNU General Public License
;; along with this package; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.  

;; Load the test framework.

(load "test-suite.scm")

(begin-section "dynamic loading")
(begin-sub-section "%dlopen")
(define lm (%dlopen "libm.so"))
;; Just check if we got after the dlopen call...
(pass-if #t #t eq?)

(begin-sub-section "%dlsym")
(define s (%dlsym lm "sin"))
(pass-if (integer? s) #t eq?)
(pass-if (catch 'dl-error
		(lambda () (%dlsym lm "__adfhalfhafhlahfasdlf") #f)
		(lambda ignore #t))
	 #t eq?)

(begin-sub-section "%dlclose")
(%dlclose lm)
;; Just check if we got after the dlopen call...
(pass-if #t #t eq?)
(pass-if (catch 'wrong-type-argument
		(lambda () (%dlsym lm "sin") #f)
		(lambda ignore #t))
	 #t eq?)

(test-summary)
