diff options
Diffstat (limited to 'Examples/test-suite/mzscheme')
| -rw-r--r-- | Examples/test-suite/mzscheme/Makefile.in | 48 | ||||
| -rw-r--r-- | Examples/test-suite/mzscheme/README | 4 | ||||
| -rw-r--r-- | Examples/test-suite/mzscheme/casts_runme.scm | 7 | ||||
| -rw-r--r-- | Examples/test-suite/mzscheme/char_constant_runme.scm | 6 | ||||
| -rw-r--r-- | Examples/test-suite/mzscheme/imports_runme.scm | 16 | ||||
| -rw-r--r-- | Examples/test-suite/mzscheme/integers_runme.scm | 9 | ||||
| -rw-r--r-- | Examples/test-suite/mzscheme/name_runme.scm | 10 | ||||
| -rw-r--r-- | Examples/test-suite/mzscheme/unions_runme.scm | 38 |
8 files changed, 138 insertions, 0 deletions
diff --git a/Examples/test-suite/mzscheme/Makefile.in b/Examples/test-suite/mzscheme/Makefile.in new file mode 100644 index 0000000..fcaf33a --- /dev/null +++ b/Examples/test-suite/mzscheme/Makefile.in @@ -0,0 +1,48 @@ +####################################################################### +# Makefile for mzscheme test-suite +####################################################################### + +LANGUAGE = mzscheme +MZSCHEME = mzscheme +SCRIPTSUFFIX = _runme.scm +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = @top_builddir@ + +include $(srcdir)/../common.mk + +# Overridden variables here +# none! + +# Custom tests - tests with additional commandline options +# none! + +# Rules for the different types of tests +%.cpptest: + $(setup) + +$(swig_and_compile_cpp) + $(run_testcase) + +%.ctest: + $(setup) + +$(swig_and_compile_c) + $(run_testcase) + +%.multicpptest: + $(setup) + +$(swig_and_compile_multi_cpp) + $(run_testcase) + +# Runs the testcase. A testcase is only run if +# 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=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + fi + +# Clean +%.clean: + + +clean: + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile mzscheme_clean diff --git a/Examples/test-suite/mzscheme/README b/Examples/test-suite/mzscheme/README new file mode 100644 index 0000000..37432ea --- /dev/null +++ b/Examples/test-suite/mzscheme/README @@ -0,0 +1,4 @@ +See ../README for common README file. + +Any testcases which have _runme.scm appended after the testcase name will be detected and run. + diff --git a/Examples/test-suite/mzscheme/casts_runme.scm b/Examples/test-suite/mzscheme/casts_runme.scm new file mode 100644 index 0000000..3aaa62d --- /dev/null +++ b/Examples/test-suite/mzscheme/casts_runme.scm @@ -0,0 +1,7 @@ +(load-extension "casts.so") + +(define x (new-B)) + +(A-hello x) + +(exit 0) diff --git a/Examples/test-suite/mzscheme/char_constant_runme.scm b/Examples/test-suite/mzscheme/char_constant_runme.scm new file mode 100644 index 0000000..4e3ed47 --- /dev/null +++ b/Examples/test-suite/mzscheme/char_constant_runme.scm @@ -0,0 +1,6 @@ +(load-extension "char_constant.so") + +(if (and (char? (CHAR-CONSTANT)) + (string? (STRING-CONSTANT))) + (exit 0) + (exit 1)) diff --git a/Examples/test-suite/mzscheme/imports_runme.scm b/Examples/test-suite/mzscheme/imports_runme.scm new file mode 100644 index 0000000..ae636aa --- /dev/null +++ b/Examples/test-suite/mzscheme/imports_runme.scm @@ -0,0 +1,16 @@ +;;; This file is part of a test for SF bug #231619. +;;; It shows that the %import directive does not work properly in SWIG +;;; 1.3a5: Type information is not properly generated if a base class +;;; comes from an %import-ed file. + +(load-extension "imports_a.so") +(load-extension "imports_b.so") + +(define x (new-B)) + +;; This fails in 1.3a5 because the SWIG runtime code does not know +;; that x (an instance of class B) can be passed to methods of class A. + +(A-hello x) + +(exit 0) diff --git a/Examples/test-suite/mzscheme/integers_runme.scm b/Examples/test-suite/mzscheme/integers_runme.scm new file mode 100644 index 0000000..03c8021 --- /dev/null +++ b/Examples/test-suite/mzscheme/integers_runme.scm @@ -0,0 +1,9 @@ +(load-extension "integers.so") +(require (lib "defmacro.ss")) + +(define-macro (throws-exception? form) + `(with-handlers ((not-break-exn? (lambda (exn) #t))) + ,form + #f)) + +(load "../schemerunme/integers.scm") diff --git a/Examples/test-suite/mzscheme/name_runme.scm b/Examples/test-suite/mzscheme/name_runme.scm new file mode 100644 index 0000000..1782c64 --- /dev/null +++ b/Examples/test-suite/mzscheme/name_runme.scm @@ -0,0 +1,10 @@ +;; The SWIG modules have "passive" Linkage, i.e., they don't generate +;; Guile modules (namespaces) but simply put all the bindings into the +;; current module. That's enough for such a simple test. +(load-extension "./name.so") + +(foo-2) +bar-2 +Baz-2 + +(exit 0) diff --git a/Examples/test-suite/mzscheme/unions_runme.scm b/Examples/test-suite/mzscheme/unions_runme.scm new file mode 100644 index 0000000..c44847c --- /dev/null +++ b/Examples/test-suite/mzscheme/unions_runme.scm @@ -0,0 +1,38 @@ +;;; This is the union runtime testcase. It ensures that values within a +;;; union embedded within a struct can be set and read correctly. + +(load-extension "unions.so") + +;; Create new instances of SmallStruct and BigStruct for later use +(define small (new-SmallStruct)) +(SmallStruct-jill-set small 200) + +(define big (new-BigStruct)) +(BigStruct-smallstruct-set big small) +(BigStruct-jack-set big 300) + +;; Use SmallStruct then BigStruct to setup EmbeddedUnionTest. +;; Ensure values in EmbeddedUnionTest are set correctly for each. +(define eut (new-EmbeddedUnionTest)) + +;; First check the SmallStruct in EmbeddedUnionTest +(EmbeddedUnionTest-number-set eut 1) +(EmbeddedUnionTest-uni-small-set (EmbeddedUnionTest-uni-get eut) + small) +(let ((Jill1 (SmallStruct-jill-get + (EmbeddedUnionTest-uni-small-get + (EmbeddedUnionTest-uni-get eut))))) + (if (not (= Jill1 200)) + (begin + (display "Runtime test 1 failed.") + (exit 1)))) + +(let ((Num1 (EmbeddedUnionTest-number-get eut))) + (if (not (= Num1 1)) + (begin + (display "Runtime test 2 failed.") + (exit 1)))) + +;; that should do + +(exit 0) |
