Rewrite chicken example and test-suite building code

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5948 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2004-05-30 07:11:26 +00:00
commit acd0b021b1
35 changed files with 315 additions and 844 deletions

View file

@ -4,11 +4,13 @@
#######################################################################
LANGUAGE = chicken
VARIANT = _module
SCRIPTSUFFIX = _runme.scm
VARIANT =
SCRIPTSUFFIX = _runme.ss
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
CHICKEN_CSI = @CHICKEN_CSI@
SO = @SO@
#C_TEST_CASES = long_long list_vector pointer_in_out multivalue
@ -37,7 +39,7 @@ include $(srcdir)/../common.mk
# a file is found which has _runme.scm appended after the testcase name.
run_testcase = \
if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then ( \
env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH ./$* $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH $(CHICKEN_CSI) $*$(SO) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX);) \
fi;
# Clean
@ -45,3 +47,4 @@ run_testcase = \
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile chicken_clean
rm -f *.scm

View file

@ -1,4 +1,7 @@
See ../README for common README file.
Any testcases which have _runme.scm appended after the testcase name will be detected and run.
Any testcases which have _runme.ss appended after the testcase name will be detected and run.
NOTE: I had to use _runme.ss becuase otherwise it would be hard to implement make clean
Since when SWIG runs it generates an example.scm file for every test, to clean those files
I needed to add a rm -f *.scm to make clean. But we don't want the runme scripts to
dissappear as well!

View file

@ -0,0 +1,36 @@
;;; This is the union runtime testcase. It ensures that values within a
;;; union embedded within a struct can be set and read correctly.
;; Create new instances of SmallStruct and BigStruct for later use
(define small (unions:new-SmallStruct))
(unions:SmallStruct-jill-set small 200)
(define big (unions:new-BigStruct))
(unions:BigStruct-smallstruct-set big small)
(unions:BigStruct-jack-set big 300)
;; Use SmallStruct then BigStruct to setup EmbeddedUnionTest.
;; Ensure values in EmbeddedUnionTest are set correctly for each.
(define eut (unions:new-EmbeddedUnionTest))
;; First check the SmallStruct in EmbeddedUnionTest
(unions:EmbeddedUnionTest-number-set eut 1)
(unions:EmbeddedUnionTest-uni-small-set (unions:EmbeddedUnionTest-uni-get eut)
small)
(let ((Jill1 (unions:SmallStruct-jill-get
(unions:EmbeddedUnionTest-uni-small-get
(unions:EmbeddedUnionTest-uni-get eut)))))
(if (not (= Jill1 200))
(begin
(display "Runtime test 1 failed.")
(exit 1))))
(let ((Num1 (unions:EmbeddedUnionTest-number-get eut)))
(if (not (= Num1 1))
(begin
(display "Runtime test 2 failed.")
(exit 1))))
;; that should do
(exit 0)