added more test cases and broken ones

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6726 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-11-15 18:45:28 +00:00
commit f1ad655a3e
12 changed files with 218 additions and 4 deletions

View file

@ -57,3 +57,13 @@ void array_pointer_func(int (*x)[10]) {}
%}
%inline %{
typedef float FLOAT;
typedef FLOAT cartPosition_t[3];
typedef struct {
cartPosition_t p;
} CartPoseData_t;
%}

View file

@ -45,8 +45,11 @@ LIBPREFIX = lib
# Broken C++ test cases. (Can be run individually using make testcase.cpptest.)
CPP_TEST_BROKEN += \
cpp_broken \
namespace_union \
overload_complicated
nested_comment \
overload_complicated \
template_expr \
# Broken C test cases. (Can be run individually using make testcase.ctest.)
C_TEST_BROKEN += \
@ -168,6 +171,7 @@ CPP_TEST_CASES += \
newobject1 \
overload_copy \
overload_extend \
overload_rename \
overload_simple \
overload_subtype \
overload_template \
@ -178,10 +182,12 @@ CPP_TEST_CASES += \
pure_virtual \
redefined \
reference_global_vars \
register_par \
rename_scope \
return_const_value \
return_value_scope \
rname \
sizet \
smart_pointer_const \
smart_pointer_const2 \
smart_pointer_multi \

View file

@ -0,0 +1,26 @@
%module cpp_broken
// bug #1060789
%inline %{
#define MASK(shift, size) (((1 << (size)) - 1) << (shift))
#define SOME_MASK_DEF (80*MASK(8, 10))
%}
// bug #1060079
%inline %{
#define FIELD(name, width) unsigned int name:width
#define SOME_CONST 2
#define NEXT_CONST (2 * SOME_CONST)
typedef struct {
FIELD(a, SOME_CONST);
FIELD(b, NEXT_CONST);
} MyStruct_t;
%}
// bug #994301
%inline %{
#define max(a,b) ((a) > (b) ? (a) : (b))
%}

View file

@ -69,9 +69,14 @@
}
template <class T> struct NameT {
};
typedef char name[8];
typedef char namea[];
typedef NameT<char> name_t[8];
char* test_a(char hello[8],
char hi[],
@ -84,11 +89,26 @@
return 1;
}
/* gcc doesn't like this one. Removing until reason resolved.
/* gcc doesn't like this one. Removing until reason resolved.*/
int test_c(const name& n1) {
return 1;
}
*/
int test_d(name* n1) {
return 1;
}
int test_e(const name_t& n1) {
return 1;
}
int test_f(name_t n1) {
return 1;
}
int test_g(name_t* n1) {
return 1;
}
struct Foo
{

View file

@ -0,0 +1,21 @@
%module nested_comment
// this example shows a problem with 'dump_nested' (parser.y).
%inline %{
typedef struct s1 {
union {
int fsc; /* genie structure hiding - Conductor
*/
int fso; /* genie structure hiding - FSOptions
*/
struct {
double *vals;
int size;
} vector_val; /* matrix values are mainly used
in rlgc models */
char *name;
} n ;
} s2;
%}

View file

@ -0,0 +1,28 @@
%module overload_rename
%{
class Foo {
public:
Foo(float a, float b=1.0)
{
}
r
Foo(float a, int c, float b=1.0)
{
}
};
%}
%rename(Foo_int) Foo::Foo(float a, int c, float b=1.0);
class Foo {
public:
Foo(float a, float b=1.0);
Foo(float a, int c, float b=1.0);
};

View file

@ -75,3 +75,8 @@ run_testcase = \
clean:
$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean
cvsignore:
@echo '*wrap* *.pyc *.so *.dll *.exp *.lib'
@echo Makefile
@for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done
@for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done

View file

@ -0,0 +1,8 @@
import overload_rename
f = overload_rename.Foo(1)
f = overload_rename.Foo(1,1)
f = overload_rename.Foo_int(1,1)
f = overload_rename.Foo_int(1,1,1)

View file

@ -0,0 +1,6 @@
%module register_par
// bug # 924413
%inline {
void clear_tree_flags(register struct tree *tp, register int i);
}

View file

@ -0,0 +1,44 @@
%module sizet
%{
#include <vector>
%}
%include "std_common.i"
%include "std_vector.i"
%inline
{
size_t test1(size_t s)
{
return s;
}
std::size_t test2(std::size_t s)
{
return s;
}
const std::size_t& test3(const std::size_t& s)
{
return s;
}
}
#ifdef SWIGPYTHON
%template(vectors) std::vector<unsigned long>;
%inline
{
std::vector<std::size_t> testv1(std::vector<std::size_t> s)
{
return s;
}
const std::vector<std::size_t>& testv2(const std::vector<std::size_t>& s)
{
return s;
}
}
#endif

View file

@ -0,0 +1,25 @@
%module template_expr
// bug #925555
%inline %{
template<int __stride, class __elementTypeSequence,
class __dataPtrType, class __elementType>
inline const ThisType &
ConcatenationOf(const vctFixedLengthConstSequenceBase<_size - 1,
__stride, __elementTypeSequence, __dataPtrType> & other,
__elementType last);
%}
// bug #956282
%inline %{
template<int q>
class X {};
%}
%template(X_1) X<1>;
%template(X_m1) X<-1>;

View file

@ -8,3 +8,18 @@ struct Foo {
};
%}
%ignore jbuf_tag;
%inline %{
typedef struct jbuf_tag
{
int mask;
} jbuf[1];
struct Ast_channel {
jbuf jmp[32];
};
%}