summaryrefslogtreecommitdiff
path: root/Examples/test-suite/mzscheme
diff options
context:
space:
mode:
authorDave Beazley <dave-swig@dabeaz.com>2002-11-30 22:01:28 +0000
committerDave Beazley <dave-swig@dabeaz.com>2002-11-30 22:01:28 +0000
commit12a43edc2df8853e8e0315f742e57be88f0c4269 (patch)
treee3237f5f8c0a67c9bfa9bb5d6d095a739a49e4b2 /Examples/test-suite/mzscheme
parent5fcae5eb66d377e1c3f81da7465c44a62295a72b (diff)
downloadswig-12a43edc2df8853e8e0315f742e57be88f0c4269.tar.gz
The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Examples/test-suite/mzscheme')
-rw-r--r--Examples/test-suite/mzscheme/.cvsignore1
-rw-r--r--Examples/test-suite/mzscheme/Makefile40
-rw-r--r--Examples/test-suite/mzscheme/README4
-rw-r--r--Examples/test-suite/mzscheme/casts_runme.scm7
-rw-r--r--Examples/test-suite/mzscheme/char_constant_runme.scm6
-rw-r--r--Examples/test-suite/mzscheme/import_runme.scm16
-rw-r--r--Examples/test-suite/mzscheme/name_runme.scm10
-rw-r--r--Examples/test-suite/mzscheme/unions_runme.scm38
8 files changed, 122 insertions, 0 deletions
diff --git a/Examples/test-suite/mzscheme/.cvsignore b/Examples/test-suite/mzscheme/.cvsignore
new file mode 100644
index 000000000..597965c42
--- /dev/null
+++ b/Examples/test-suite/mzscheme/.cvsignore
@@ -0,0 +1 @@
+*wrap.c*
diff --git a/Examples/test-suite/mzscheme/Makefile b/Examples/test-suite/mzscheme/Makefile
new file mode 100644
index 000000000..ead394b57
--- /dev/null
+++ b/Examples/test-suite/mzscheme/Makefile
@@ -0,0 +1,40 @@
+#######################################################################
+# $Header$
+# Makefile for mzscheme test-suite
+#######################################################################
+
+LANGUAGE = mzscheme
+SCRIPTSUFFIX = _runme.scm
+
+include ../common.mk
+
+# Overridden variables here
+
+# 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 $*\_runme.scm ]; then ( \
+ env LD_LIBRARY_PATH=$(DYNAMIC_LIB_PATH):$$LD_LIBRARY_PATH mzscheme -r $*\_runme.scm;) \
+ fi;
+
+# Clean
+%.clean:
+
+clean:
+ $(MAKE) -f $(TOP)/Makefile mzscheme_clean
diff --git a/Examples/test-suite/mzscheme/README b/Examples/test-suite/mzscheme/README
new file mode 100644
index 000000000..37432ea4b
--- /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 000000000..3aaa62dc6
--- /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 000000000..4e3ed47ca
--- /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/import_runme.scm b/Examples/test-suite/mzscheme/import_runme.scm
new file mode 100644
index 000000000..8e8f27339
--- /dev/null
+++ b/Examples/test-suite/mzscheme/import_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 "libimports_a.so")
+(load-extension "libimports_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/name_runme.scm b/Examples/test-suite/mzscheme/name_runme.scm
new file mode 100644
index 000000000..1782c6481
--- /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 000000000..c44847cfc
--- /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)