John Lenz wrote:
I have recently been working on the guile module (as discussed before....) and to help test it I have added a bunch of _runme.scm files to the guile test-suite. Mostly I just copied the python tests. What I mean is the guile tests call exactly the same functions as the _runme.py files. Also a couple of tests (name_runme.scm, list_vector_runme.scm, and char_constant_runme.scm) were not calling the correct initilization function, so I fixed those too. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4193 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
83e0c52c5a
commit
e3eb2528cb
13 changed files with 175 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
;; 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.
|
||||
(dynamic-call "scm_init_test_module" (dynamic-link "./libchar_constant.so"))
|
||||
(dynamic-call "scm_init_char_constant_module" (dynamic-link "./libchar_constant.so"))
|
||||
|
||||
(if (and (char? (CHAR-CONSTANT))
|
||||
(string? (STRING-CONSTANT)))
|
||||
|
|
|
|||
8
Examples/test-suite/guile/class_ignore_runme.scm
Normal file
8
Examples/test-suite/guile/class_ignore_runme.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(dynamic-call "scm_init_class_ignore_module" (dynamic-link "./libclass_ignore.so"))
|
||||
|
||||
(define a (new-Bar))
|
||||
|
||||
(if (not (string=? (Bar-blah a) "Bar::blah"))
|
||||
(error "Wrong string"))
|
||||
|
||||
(exit 0)
|
||||
28
Examples/test-suite/guile/constover_runme.scm
Normal file
28
Examples/test-suite/guile/constover_runme.scm
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
(dynamic-call "scm_init_constover_module" (dynamic-link "./libconstover.so"))
|
||||
|
||||
(define p (test "test"))
|
||||
(if (not (string=? p "test"))
|
||||
(error "test failed!"))
|
||||
|
||||
(set! p (test-pconst "test"))
|
||||
(if (not (string=? p "test_pconst"))
|
||||
(error "test_pconst failed!"))
|
||||
|
||||
(define f (new-Foo))
|
||||
(set! p (Foo-test f "test"))
|
||||
(if (not (string=? p "test"))
|
||||
(error "member-test failed!"))
|
||||
|
||||
(set! p (Foo-test-pconst f "test"))
|
||||
(if (not (string=? p "test_pconst"))
|
||||
(error "member-test_pconst failed!"))
|
||||
|
||||
(set! p (Foo-test-constm f "test"))
|
||||
(if (not (string=? p "test_constmethod"))
|
||||
(error "member-test_constm failed!"))
|
||||
|
||||
(set! p (Foo-test-pconstm f "test"))
|
||||
(if (not (string=? p "test_pconstmethod"))
|
||||
(error "member-test_pconstm failed!"))
|
||||
|
||||
(exit 0)
|
||||
44
Examples/test-suite/guile/cpp_namespace_runme.scm
Normal file
44
Examples/test-suite/guile/cpp_namespace_runme.scm
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
(dynamic-call "scm_init_cpp_namespace_module" (dynamic-link "./libcpp_namespace.so"))
|
||||
|
||||
(define n (fact 4))
|
||||
(if (not (= n 24))
|
||||
(error "Bad return value!"))
|
||||
|
||||
(if (not (= (Foo) 42))
|
||||
(error "bad variable value!"))
|
||||
|
||||
(define t (new-Test))
|
||||
(if (not (string=? (Test-method t) "Test::method"))
|
||||
(error "Bad method return value!"))
|
||||
|
||||
(if (not (string=? (do-method t) "Test::method"))
|
||||
(error "Bad return value!"))
|
||||
|
||||
(if (not (string=? (do-method2 t) "Test::method"))
|
||||
(error "Bad return value!"))
|
||||
|
||||
(weird "hello" 4)
|
||||
|
||||
(delete-Test t)
|
||||
|
||||
(define t2 (new-Test2))
|
||||
(define t3 (new-Test3))
|
||||
(define t4 (new-Test4))
|
||||
(define t5 (new-Test5))
|
||||
|
||||
(if (not (= (foo3 42) 42))
|
||||
(error "Bad return value!"))
|
||||
|
||||
(if (not (string=? (do-method3 t2 40) "Test2::method"))
|
||||
(error "bad return value!"))
|
||||
|
||||
(if (not (string=? (do-method3 t3 40) "Test3::method"))
|
||||
(error "bad return value"))
|
||||
|
||||
(if (not (string=? (do-method3 t4 40) "Test4::method"))
|
||||
(error "bad return value"))
|
||||
|
||||
(if (not (string=? (do-method3 t5 40) "Test5::method"))
|
||||
(error "bad return value"))
|
||||
|
||||
(exit 0)
|
||||
13
Examples/test-suite/guile/dynamic_cast_runme.scm
Normal file
13
Examples/test-suite/guile/dynamic_cast_runme.scm
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(dynamic-call "scm_init_dynamic_cast_module" (dynamic-link "./libdynamic_cast.so"))
|
||||
|
||||
(define f (new-Foo))
|
||||
(define b (new-Bar))
|
||||
|
||||
(define x (Foo-blah f))
|
||||
(define y (Bar-blah b))
|
||||
|
||||
(define a (do-test y))
|
||||
(if (not (string=? a "Bar::test"))
|
||||
(error "Failed!"))
|
||||
|
||||
(exit 0)
|
||||
9
Examples/test-suite/guile/import_nomodule_runme.scm
Normal file
9
Examples/test-suite/guile/import_nomodule_runme.scm
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(dynamic-call "scm_init_import_nomodule_module" (dynamic-link "./libimport_nomodule.so"))
|
||||
|
||||
(define f (create-Foo))
|
||||
(test1 f 42)
|
||||
|
||||
(define b (new-Bar))
|
||||
(test1 b 37)
|
||||
|
||||
(exit 0)
|
||||
16
Examples/test-suite/guile/inherit_missing_runme.scm
Normal file
16
Examples/test-suite/guile/inherit_missing_runme.scm
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(dynamic-call "scm_init_inherit_missing_module" (dynamic-link "./libinherit_missing.so"))
|
||||
|
||||
(define a (new-Foo))
|
||||
(define b (new-Bar))
|
||||
(define c (new-Spam))
|
||||
|
||||
(if (not (string=? (do-blah a) "Foo::blah"))
|
||||
(error "Bad return"))
|
||||
|
||||
(if (not (string=? (do-blah b) "Bar::blah"))
|
||||
(error "Bad return"))
|
||||
|
||||
(if (not (string=? (do-blah c) "Spam::blah"))
|
||||
(error "bad return"))
|
||||
|
||||
(exit 0)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
;; 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.
|
||||
(dynamic-call "scm_init_test_module" (dynamic-link "./liblist_vector.so"))
|
||||
(dynamic-call "scm_init_list_vector_module" (dynamic-link "./liblist_vector.so"))
|
||||
|
||||
(define-macro (check form)
|
||||
`(if (not ,form)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
;; 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.
|
||||
(dynamic-call "scm_init_test_module" (dynamic-link "./libname.so"))
|
||||
(dynamic-call "scm_init_name_module" (dynamic-link "./libname.so"))
|
||||
|
||||
(foo-2)
|
||||
bar-2
|
||||
|
|
|
|||
6
Examples/test-suite/guile/overload_copy_runme.scm
Normal file
6
Examples/test-suite/guile/overload_copy_runme.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(dynamic-call "scm_init_overload_copy_module" (dynamic-link "./liboverload_copy.so"))
|
||||
|
||||
(define f (new-Foo))
|
||||
(define g (new-Foo f))
|
||||
|
||||
(exit 0)
|
||||
14
Examples/test-suite/guile/overload_extend_runme.scm
Normal file
14
Examples/test-suite/guile/overload_extend_runme.scm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(dynamic-call "scm_init_overload_extend_module" (dynamic-link "./liboverload_extend.so"))
|
||||
|
||||
(define f (new-Foo))
|
||||
|
||||
(if (not (= (Foo-test f 3) 1))
|
||||
(error "test integer bad"))
|
||||
|
||||
(if (not (= (Foo-test f "hello") 2))
|
||||
(error "test string bad"))
|
||||
|
||||
(if (not (= (Foo-test f 3.5 2.5) 3))
|
||||
(error "test reals bad"))
|
||||
|
||||
(exit 0)
|
||||
19
Examples/test-suite/guile/typedef_inherit_runme.scm
Normal file
19
Examples/test-suite/guile/typedef_inherit_runme.scm
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
(dynamic-call "scm_init_typedef_inherit_module" (dynamic-link "./libtypedef_inherit.so"))
|
||||
|
||||
(define a (new-Foo))
|
||||
(define b (new-Bar))
|
||||
|
||||
(if (not (string=? (do-blah a) "Foo::blah"))
|
||||
(error "bad return"))
|
||||
|
||||
(if (not (string=? (do-blah b) "Bar::blah"))
|
||||
(error "bad return"))
|
||||
|
||||
(define c (new-Spam))
|
||||
(define d (new-Grok))
|
||||
|
||||
(if (not (string=? (do-blah2 c) "Spam::blah"))
|
||||
(error "bad return"))
|
||||
|
||||
(if (not (string=? (do-blah2 d) "Grok::blah"))
|
||||
(error "bad return"))
|
||||
15
Examples/test-suite/guile/typename_runme.scm
Normal file
15
Examples/test-suite/guile/typename_runme.scm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(dynamic-call "scm_init_typename_module" (dynamic-link "./libtypename.so"))
|
||||
(dynamic-call "scm_init_types_module" (dynamic-link "./libtypes.so"))
|
||||
|
||||
(define f (new-Foo))
|
||||
(define b (new-Bar))
|
||||
|
||||
(define x (twoFoo f))
|
||||
(if (not (isinstance x (types-FloatType)))
|
||||
(error "wrong return type"))
|
||||
|
||||
(define y (twoBar b))
|
||||
(if (not (isinstance y (types-IntType)))
|
||||
(error "wrong return type"))
|
||||
|
||||
(exit 0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue