Added minherit test + runme.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4870 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Art Yerkes 2003-06-06 15:16:32 +00:00
commit 7f9f4144ce
4 changed files with 154 additions and 12 deletions

View file

@ -6,7 +6,7 @@
%module(ruby_minherit="1") minherit
#if defined(SWIGPYTHON) || defined(SWIGRUBY)
#if defined(SWIGPYTHON) || defined(SWIGRUBY) || defined(SWIGOCAML)
%inline %{

View file

@ -0,0 +1,130 @@
(* Stolen from the python tests *)
open Minherit
let a = new_Foo C_void
let b = new_Bar C_void
let c = new_FooBar C_void
let d = new_Spam C_void
let soci x = (string_of_int (get_int x))
let _ =
if (invoke a) "xget" C_void <> (C_int 1) then
raise (Failure "Bad attribute value (a.xget)")
let _ =
if (invoke b) "yget" C_void <> (C_int 2) then
raise (Failure "Bad attribute value (b.yget)")
let _ =
if (invoke c) "xget" C_void <> (C_int 1)
|| (invoke c) "yget" C_void <> (C_int 2)
|| (invoke c) "zget" C_void <> (C_int 3) then
raise (Failure "Bad attribute value c")
let _ =
if (invoke d) "xget" C_void <> (C_int 1)
|| (invoke d) "yget" C_void <> (C_int 2)
|| (invoke d) "zget" C_void <> (C_int 3)
|| (invoke d) "wget" C_void <> (C_int 4) then
raise (Failure "Bad attribute value d")
let xga = _xget a
let _ =
if xga <> (C_int 1) then
raise (Failure ("Bad attribute value (xget a): " ^ (soci xga)))
let ygb = _yget b
let _ =
if ygb <> (C_int 2) then
raise (Failure ("Bad attribute value (yget b): " ^
(string_of_int (get_int ygb))))
let xgc = _xget c and ygc = _yget c and zgc = _zget c
let _ =
if xgc <> (C_int 1) || ygc <> (C_int 2) || zgc <> (C_int 3) then
raise (Failure ("Bad attribute value (xgc=" ^ (soci xgc) ^
" (sb 1) ygc=" ^ (soci ygc) ^
" (sb 2) zgc=" ^ (soci zgc) ^
" (sb 3))"))
let xgd = _xget d and ygd = _yget d and zgd = _zget d and wgd = _wget d
let _ =
if xgd <> (C_int 1) || ygd <> (C_int 2)
|| zgd <> (C_int 3) || wgd <> (C_int 4) then
raise (Failure ("Bad attribute value (xgd=" ^ (soci xgd) ^
" (sb 1) ygd=" ^ (soci ygd) ^
" (sb 2) zgd=" ^ (soci zgd) ^
" (sb 3)"))
(* Cleanse all of the pointers and see what happens *)
let aa = _toFooPtr a
let bb = _toBarPtr b
let cc = _toFooBarPtr c
let dd = _toSpamPtr d
let xgaa = (invoke aa) "xget" C_void
let _ =
if xgaa <> (C_int 1) then
raise (Failure ("Bad attribute value xgaa " ^ (soci xgaa)))
let ygbb = (invoke bb) "yget" C_void
let _ =
if ygbb <> (C_int 2) then
raise (Failure ("Bad attribute value ygbb " ^ (soci ygbb)))
let xgcc = (invoke cc) "xget" C_void
and ygcc = (invoke cc) "yget" C_void
and zgcc = (invoke cc) "zget" C_void
let _ =
if xgcc <> (C_int 1) || ygcc <> (C_int 2) || zgcc <> (C_int 3) then
raise (Failure ("Bad attribute value (" ^
(soci xgcc) ^ " (sb 1) " ^
(soci ygcc) ^ " (sb 2) " ^
(soci zgcc) ^ " (sb 3))"))
let xgdd = (invoke dd) "xget" C_void
and ygdd = (invoke dd) "yget" C_void
and zgdd = (invoke dd) "zget" C_void
and wgdd = (invoke dd) "wget" C_void
let _ =
if xgdd <> (C_int 1) || ygdd <> (C_int 2)
|| zgdd <> (C_int 3) || wgdd <> (C_int 4) then
raise (Failure ("Bad value: " ^
"xgdd=" ^ (soci xgdd) ^
"ygdd=" ^ (soci ygdd) ^
"zgdd=" ^ (soci zgdd) ^
"wgdd=" ^ (soci wgdd)))
let xgaa = _xget aa
and ygbb = _yget bb
and xgcc = _xget cc
and ygcc = _yget cc
and zgcc = _zget cc
and xgdd = _xget dd
and ygdd = _yget dd
and zgdd = _zget dd
and wgdd = _wget dd
let _ =
if xgaa <> (C_int 1) then
raise (Failure ("Fn xget: xgaa=" ^ (soci xgaa)))
let _ =
if ygbb <> (C_int 2) then
raise (Failure ("Fn yget: ygbb=" ^ (soci ygbb)))
let _ =
if xgcc <> (C_int 1) || ygcc <> (C_int 2) || zgcc <> (C_int 3) then
raise (Failure ("CC with fns: (" ^
(soci xgcc) ^ " " ^ (soci ygcc) ^ " " ^ (soci zgcc)))
let _ =
if xgdd <> (C_int 1) || ygdd <> (C_int 2)
|| zgdd <> (C_int 3) || wgdd <> (C_int 4) then
raise (Failure ("CC with fns: (" ^
(soci xgdd) ^ " " ^ (soci ygdd) ^ " " ^
(soci zgdd) ^ " " ^ (soci wgdd) ^ ")"))

View file

@ -1,10 +1,5 @@
Failed:
bools.cpptest
director_exception.cpptest
lib_std_string.cpptest
namespace_typemap.cpptest
private_assign.cpptest
template_type_namespace.cpptest
typedef_inherit.cpptest
template_typedef_import.multicpptest
Success:
abstract_inherit.cpptest
@ -18,13 +13,17 @@ anonymous_arg.cpptest
anonymous_bitfield.cpptest
argout.cpptest
arrayref.cpptest
arrays_dimensionless.cpptest
arrays_global.cpptest
arrays_global_twodim.cpptest
arrays_scope.cpptest
bloody_hell.cpptest
bool_default.cpptest
bools.cpptest
casts.cpptest
cast_operator.cpptest
class_ignore.cpptest
class_scope_weird.cpptest
const_const_2.cpptest
constant_pointers.cpptest
constover.cpptest
@ -42,10 +41,12 @@ cpp_nodefault.cpptest
cpp_static.cpptest
cpp_typedef.cpptest
default_cast.cpptest
default_char.cpptest
default_constructor.cpptest
default_ns.cpptest
default_ref.cpptest
director_basic.cpptest
director_exception.cpptest
director_finalizer.cpptest
director_unroll.cpptest
dynamic_cast.cpptest
@ -57,6 +58,7 @@ evil_diamond.cpptest
evil_diamond_ns.cpptest
evil_diamond_prop.cpptest
explicit.cpptest
extend_placement.cpptest
extend_template.cpptest
extend_template_ns.cpptest
global_ns_arg.cpptest
@ -64,11 +66,13 @@ grouping.cpptest
ignore_parameter.cpptest
import_nomodule.cpptest
inherit_missing.cpptest
inline_initializer.cpptest
kind.cpptest
lib_carrays.cpptest
lib_cdata.cpptest
lib_cpointer.cpptest
lib_std_deque.cpptest
lib_std_string.cpptest
lib_std_vector.cpptest
lib_typemaps.cpptest
long_long_apply.cpptest
@ -78,7 +82,10 @@ name_cxx.cpptest
name_inherit.cpptest
namespace_enum.cpptest
namespace_extend.cpptest
namespace_nested.cpptest
namespace_template.cpptest
namespace_typemap.cpptest
namespace_virtual_method.cpptest
newobject1.cpptest
overload_complicated.cpptest
overload_copy.cpptest
@ -88,6 +95,7 @@ overload_subtype.cpptest
overload_template.cpptest
pointer_reference.cpptest
primitive_ref.cpptest
private_assign.cpptest
pure_virtual.cpptest
reference_global_vars.cpptest
rename_default.cpptest
@ -125,13 +133,14 @@ template_enum.cpptest
template_enum_ns_inherit.cpptest
template_enum_typedef.cpptest
template_explicit.cpptest
template_extend_overload.cpptest
template_extend_overload_2.cpptest
template_extend1.cpptest
template_extend2.cpptest
template_forward.cpptest
template_inherit.cpptest
template_inherit_abstract.cpptest
template_int_const.cpptest
template_ns.cpptest
template_ns2.cpptest
template_ns3.cpptest
template_ns4.cpptest
@ -140,11 +149,13 @@ template_ns_enum2.cpptest
template_ns_inherit.cpptest
template_ns_scope.cpptest
template_qualifier.cpptest
template_ref_type.cpptest
template_rename.cpptest
template_retvalue.cpptest
template_specialization.cpptest
template_static.cpptest
template_tbase_template.cpptest
template_type_namespace.cpptest
template_typedef.cpptest
template_typedef_cplx.cpptest
template_typedef_cplx2.cpptest
@ -154,8 +165,8 @@ template_virtual.cpptest
template_whitespace.cpptest
throw_exception.cpptest
typedef_array_member.cpptest
typedef_class.cpptest
typedef_funcptr.cpptest
typedef_inherit.cpptest
typedef_mptr.cpptest
typedef_reference.cpptest
typedef_scope.cpptest
@ -170,7 +181,9 @@ using_extend.cpptest
using_inherit.cpptest
using_private.cpptest
using_protected.cpptest
valuewrapper.cpptest
valuewrapper_base.cpptest
valuewrapper_const.cpptest
varargs.cpptest
virtual_destructor.cpptest
voidtest.cpptest
@ -181,7 +194,7 @@ const_const.ctest
cpp_macro_noarg.ctest
defineop.ctest
defines.ctest
enum.ctest
enums.ctest
function_typedef.ctest
lib_carrays.ctest
lib_cdata.ctest
@ -200,6 +213,7 @@ preproc_2.ctest
preproc_3.ctest
preproc_4.ctest
preproc_5.ctest
preproc_6.ctest
ret_by_value.ctest
sizeof_pointer.ctest
sneaky1.ctest