Initial commit

This commit is contained in:
Bassem Girgis
2018-12-20 17:34:07 -06:00
parent 7a2d899662
commit 81b4b9e273
34743 changed files with 5940233 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
#######################################################################
# 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 $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
fi
# Clean
%.clean:
@exit 0
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean

View File

@@ -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.

View File

@@ -0,0 +1,7 @@
(load-extension "casts.so")
(define x (new-B))
(A-hello x)
(exit 0)

View File

@@ -0,0 +1,6 @@
(load-extension "char_constant.so")
(if (and (char? (CHAR-CONSTANT))
(string? (STRING-CONSTANT)))
(exit 0)
(exit 1))

View File

@@ -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)

View File

@@ -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")

View File

@@ -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)

View File

@@ -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)