modify test-suite (barring python atm) to not rely on the -I path to find the input .i file - removes the new warning 125 and sets up the test-suite for testing with ccache. This change required the use of -outcurrentdir and moving the .i files from the language subdirectories to the directory above along with some .i file name changes.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10949 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
53f786e5a6
commit
db83e51441
61 changed files with 390 additions and 709 deletions
|
|
@ -10,8 +10,8 @@ srcdir = @srcdir@
|
|||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
C_TEST_CASES = copy_struct simple_array legacy
|
||||
CPP_TEST_CASES = double_delete
|
||||
C_TEST_CASES = r_copy_struct r_legacy
|
||||
CPP_TEST_CASES = r_double_delete
|
||||
|
||||
include $(srcdir)/../common.mk
|
||||
|
||||
|
|
|
|||
|
|
@ -1,93 +0,0 @@
|
|||
%module copy_struct
|
||||
|
||||
%feature("opaque", "yes") B;
|
||||
%feature("opaque", "yes") C;
|
||||
|
||||
%inline %{
|
||||
struct A {
|
||||
int i;
|
||||
unsigned int ui;
|
||||
double d;
|
||||
char* str;
|
||||
int **tmp;
|
||||
};
|
||||
|
||||
struct A getA();
|
||||
struct A* getARef();
|
||||
|
||||
typedef struct {
|
||||
int invisible;
|
||||
} B;
|
||||
|
||||
struct C {
|
||||
int invisible;
|
||||
double blind;
|
||||
};
|
||||
|
||||
typedef B C;
|
||||
|
||||
B* getBRef();
|
||||
struct C* getCRef();
|
||||
|
||||
C* getCCRef();
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
double u;
|
||||
} D;
|
||||
|
||||
struct A
|
||||
getA()
|
||||
{
|
||||
struct A a;
|
||||
|
||||
a.i = 10;
|
||||
a.d = 3.1415;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
static struct A fixed = {20, 3, 42.0};
|
||||
|
||||
struct A *
|
||||
getARef()
|
||||
{
|
||||
return(&fixed);
|
||||
}
|
||||
|
||||
|
||||
static B bb = {101};
|
||||
|
||||
B*
|
||||
getBRef()
|
||||
{
|
||||
return(&bb);
|
||||
}
|
||||
|
||||
struct C cc = {201, 3.14159};
|
||||
struct C *
|
||||
getCRef()
|
||||
{
|
||||
return(&cc);
|
||||
}
|
||||
|
||||
|
||||
C*
|
||||
getCCRef()
|
||||
{
|
||||
return(&bb);
|
||||
}
|
||||
|
||||
D
|
||||
bar()
|
||||
{ D a;
|
||||
a.x = 1;
|
||||
a.u = 0;
|
||||
return(a);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/* File : example.i */
|
||||
%module double_delete
|
||||
|
||||
%inline %{
|
||||
|
||||
class Foo {
|
||||
private:
|
||||
double r;
|
||||
public:
|
||||
Foo(double rin) : r(rin) {};
|
||||
};
|
||||
%}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file illustrates the proxy class C++ interface generated
|
||||
# by SWIG.
|
||||
|
||||
dyn.load(paste("double_delete", .Platform$dynlib.ext, sep=""))
|
||||
source("double_delete.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
f <- Foo(2.0)
|
||||
delete(f);
|
||||
delete(f);
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
%module legacy
|
||||
%inline %{
|
||||
typedef char *String;
|
||||
|
||||
typedef struct {
|
||||
int i;
|
||||
double d;
|
||||
char *str;
|
||||
String s;
|
||||
} Obj;
|
||||
|
||||
Obj *getObject(int i, double d);
|
||||
|
||||
#include <string.h>
|
||||
|
||||
Obj *
|
||||
getObject(int i, double d)
|
||||
{
|
||||
|
||||
const char *test_string = "a test string";
|
||||
Obj *obj;
|
||||
obj = (Obj *) calloc(1, sizeof(Obj));
|
||||
|
||||
obj->i = i;
|
||||
obj->d = d;
|
||||
/* allocate one extra byte for the null */
|
||||
obj->str = (char *)malloc(strlen(test_string) + 1);
|
||||
strcpy(obj->str, test_string);
|
||||
|
||||
return(obj);
|
||||
}
|
||||
%}
|
||||
|
||||
char *getString();
|
||||
int getInt();
|
||||
double getDouble();
|
||||
float getFloat();
|
||||
long getLong();
|
||||
unsigned long getUnsignedLong();
|
||||
char getChar();
|
||||
|
||||
extern unsigned long MyULong;
|
||||
|
||||
extern const double PiSquared;
|
||||
|
||||
#if 0
|
||||
extern float *MyFloatRef;
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
#define PI 3.14159265358979
|
||||
unsigned long MyULong = 20;
|
||||
|
||||
static float MyFloat = 1.05f;
|
||||
float *MyFloatRef = &MyFloat;
|
||||
|
||||
const double PiSquared = PI * PI;
|
||||
|
||||
char *getString()
|
||||
{
|
||||
return "This is a literal string";
|
||||
}
|
||||
|
||||
int
|
||||
getInt()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
double
|
||||
getDouble()
|
||||
{
|
||||
return PI;
|
||||
}
|
||||
|
||||
float
|
||||
getFloat()
|
||||
{
|
||||
return (float)PI/2;
|
||||
}
|
||||
|
||||
long getLong()
|
||||
{
|
||||
return -321313L;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
getUnsignedLong()
|
||||
{
|
||||
return 23123L;
|
||||
}
|
||||
|
||||
char
|
||||
getChar()
|
||||
{
|
||||
return('A');
|
||||
}
|
||||
%}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
source("unittest.R")
|
||||
dyn.load(paste("copy_struct", .Platform$dynlib.ext, sep=""))
|
||||
source("copy_struct.R")
|
||||
dyn.load(paste("r_copy_struct", .Platform$dynlib.ext, sep=""))
|
||||
source("r_copy_struct.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
a <- getA()
|
||||
9
Examples/test-suite/r/r_double_delete_runme.R
Normal file
9
Examples/test-suite/r/r_double_delete_runme.R
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
dyn.load(paste("r_double_delete", .Platform$dynlib.ext, sep=""))
|
||||
source("r_double_delete.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
# ----- Object creation -----
|
||||
|
||||
f <- Foo(2.0)
|
||||
delete(f);
|
||||
delete(f);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
source("unittest.R")
|
||||
dyn.load(paste("legacy", .Platform$dynlib.ext, sep=""))
|
||||
source("legacy.R")
|
||||
dyn.load(paste("r_legacy", .Platform$dynlib.ext, sep=""))
|
||||
source("r_legacy.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
obj <- getObject(1,3)
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
%module simple_array
|
||||
|
||||
extern int x[10];
|
||||
extern double y[7];
|
||||
|
||||
|
||||
%inline %{
|
||||
|
||||
struct BarArray {
|
||||
int i;
|
||||
double d;
|
||||
};
|
||||
|
||||
extern struct BarArray bars[2];
|
||||
|
||||
int x[10];
|
||||
double y[7];
|
||||
struct BarArray bars[2];
|
||||
|
||||
void
|
||||
initArray()
|
||||
{
|
||||
int i, n;
|
||||
|
||||
n = sizeof(x)/sizeof(x[0]);
|
||||
for(i = 0; i < n; i++)
|
||||
x[i] = i;
|
||||
|
||||
n = sizeof(y)/sizeof(y[0]);
|
||||
for(i = 0; i < n; i++)
|
||||
y[i] = ((double) i)/ ((double) n);
|
||||
|
||||
n = sizeof(bars)/sizeof(bars[0]);
|
||||
for(i = 0; i < n; i++) {
|
||||
bars[i].i = x[i+2];
|
||||
bars[i].d = y[i+2];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue