several fixes, see CHANGES.current 10/04/2004

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6317 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-10-05 00:19:26 +00:00
commit 2792ac8752
17 changed files with 216 additions and 97 deletions

View file

@ -45,17 +45,12 @@ LIBPREFIX = lib
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
CPP_TEST_BROKEN += \
defvalue_constructor \
derived_nested \
features \
multiple_inheritance \
namespace_union \
overload_complicated \
return_const_value \
smart_pointer_namespace2 \
template_default_arg \
template_specialization_defarg \
template_specialization_enum \
template_typedef_ptr \
using_namespace
@ -117,6 +112,7 @@ CPP_TEST_CASES += \
default_ns \
default_args \
default_ref \
defvalue_constructor \
director_abstract \
director_basic \
director_detect \
@ -142,6 +138,7 @@ CPP_TEST_CASES += \
extend_template \
extend_template_ns \
extern_throws \
features \
friends \
global_ns_arg \
grouping \
@ -188,6 +185,7 @@ CPP_TEST_CASES += \
reference_global_vars \
rename_default \
rename_scope \
return_const_value \
return_value_scope \
rname \
smart_pointer_const \
@ -217,6 +215,7 @@ CPP_TEST_CASES += \
template_construct \
template_default \
template_default2 \
template_default_arg \
template_default_inherit \
template_default_qualify \
template_default_vw \
@ -248,6 +247,7 @@ CPP_TEST_CASES += \
template_rename \
template_retvalue \
template_specialization \
template_specialization_enum \
template_static \
template_tbase_template \
template_type_namespace \

View file

@ -6,15 +6,29 @@
%exception "this_will_not_compile";
// Test 1: Test for no user supplied constructors and destructor
%exception Simple::Simple "$action /*Simple::Simple*/";
%exception Simple::~Simple "$action /*Simple::~Simple*/";
%exception Simple::Simple() "$action /*Simple::Simple*/";
%exception Simple::~Simple() "$action /*Simple::~Simple*/";
%inline %{
class Simple {};
%}
%exception NS::SimpleNS::SimpleNS() "$action /*Simple::Simple*/";
%exception NS::SimpleNS::~SimpleNS() "$action /*Simple::~Simple*/";
%inline %{
namespace NS
{
class SimpleNS {};
}
%}
// Test 2: Test templated functions
%exception foobar<int> "$action /*foobar<int>*/";
%exception foobar "caca";
%exception foobar<int>(int) "$action /*foobar<int>*/";
%inline %{
template<class T> void foobar(T t) {}
@ -23,34 +37,33 @@ template<class T> void foobar(T t) {}
%template(FooBarInt) foobar<int>;
// Test 3: Test templates with no user supplied constructors and destructor
%exception SimpleTemplate<int>::SimpleTemplate<int> "$action /*SimpleTemplate<int>::SimpleTemplate<int>*/";
%exception SimpleTemplate<int>::~SimpleTemplate "$action /*SimpleTemplate<int>::~SimpleTemplate*/";
%exception SimpleTemplate<int>::SimpleTemplate() "$action /*SimpleTemplate<int>::SimpleTemplate<int>*/";
%exception SimpleTemplate<int>::~SimpleTemplate() "$action /*SimpleTemplate<int>::~SimpleTemplate*/";
%inline %{
template<class T> class SimpleTemplate {};
template<class T> class SimpleTemplate {
public:
};
%}
%template(SimpleDouble) SimpleTemplate<double>;
%template(SimpleInt) SimpleTemplate<int>;
// Test 4: Test templates with user supplied constructors and destructor
%exception Template<int>::Template "$action /*Template<int>::Template<int>*/";
%exception Template<int>::Template() "$action /*Template<int>::Template<int>*/";
%exception Template<int>::Template(const Template&) "$action /*Template<int>::Template<int>(const Template&)*/";
%exception Template<int>::~Template "$action /*Template<int>::~Template*/";
%exception Template<int>::~Template() "$action /*Template<int>::~Template*/";
%exception Template<int>::foo "$action /*Template<int>::foo*/";
%inline %{
template<class T> class Template {
public:
Template();
Template(const Template&);
~Template();
void foo();
Template(){}
Template(const Template&){}
~Template(){}
void foo(){}
};
// Supply methods just for the int case. Note syntax is same as the %exception syntax.
Template<int>::Template() {}
Template<int>::Template(const Template&) {}
Template<int>::~Template() {}
void Template<int>::foo() {}
%}
%template(TemplateInt) Template<int>;

View file

@ -2,6 +2,7 @@
%inline %{
struct Foo {
int test() { return 0; }
};
%}

View file

@ -1,6 +1,8 @@
import overload_extend
f = overload_extend.Foo()
if f.test() != 0:
raise RuntimeError
if f.test(3) != 1:
raise RuntimeError
if f.test("hello") != 2:

View file

@ -1,12 +1,12 @@
import return_const_value
import sys
p = return_const_value.FooPtr.getPtr()
p = return_const_value.Foo_ptr.getPtr()
if (p.getVal() != 17):
print "Runtime test1 faild. p.getVal()=", p.getVal()
sys.exit(1)
p = return_const_value.FooPtr.getConstPtr()
p = return_const_value.Foo_ptr.getConstPtr()
if (p.getVal() != 17):
print "Runtime test2 faild. p.getVal()=", p.getVal()
sys.exit(1)

View file

@ -14,15 +14,15 @@ public:
}
};
class FooPtr {
class Foo_ptr {
Foo *_ptr;
public:
FooPtr(Foo *p): _ptr(p) {}
static FooPtr getPtr() {
return FooPtr(new Foo(17));
Foo_ptr(Foo *p): _ptr(p) {}
static Foo_ptr getPtr() {
return Foo_ptr(new Foo(17));
}
static const FooPtr getConstPtr() {
return FooPtr(new Foo(17));
static const Foo_ptr getConstPtr() {
return Foo_ptr(new Foo(17));
}
const Foo *operator->() {
return _ptr;

View file

@ -13,6 +13,11 @@
// This doesn't
Hello(size_type n = size_type(0) ) { }
enum Hi { hi, hello };
void foo(Hi h = hi) { }
};
%}

View file

@ -16,14 +16,10 @@
return 0;
}
C(int a = 0)
C(int a)
{
}
protected:
C()
{
}
};
@ -35,14 +31,10 @@
return 0;
}
C(double a = 0)
C(double a)
{
}
protected:
C()
{
}
};

View file

@ -24,7 +24,7 @@
template <class A>
struct C<hello , A> : Base<hello, A>
{
int hello()
int fhello()
{
return hello;
}
@ -39,7 +39,7 @@
template <class A>
struct C<hi , A> : Base<hi, A>
{
int hi()
int fhi()
{
return hi;
}