mirror of https://github.com/swig/swig
add support files and regression tests for #1124
This commit is contained in:
parent
0b97170f1d
commit
5525abfea8
|
@ -0,0 +1,11 @@
|
|||
clargs <- commandArgs(trailing=TRUE)
|
||||
source(file.path(clargs[1], "unittest.R"))
|
||||
|
||||
dyn.load(paste("r_use_isnull", .Platform$dynlib.ext, sep=""))
|
||||
source("r_use_isnull.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
tp <- pointerTest()
|
||||
circ1 <- tp$getCircle(1)
|
||||
circ1
|
||||
unittest(is.null(circ1), TRUE)
|
|
@ -0,0 +1,34 @@
|
|||
%module r_use_isnull
|
||||
|
||||
%inline %{
|
||||
// C++ code
|
||||
class circle {
|
||||
public:
|
||||
circle(double radius)
|
||||
{
|
||||
m_radius = radius;
|
||||
}
|
||||
double getArea() const
|
||||
{
|
||||
return (3.14 * m_radius * m_radius);
|
||||
}
|
||||
|
||||
private:
|
||||
double m_radius;
|
||||
};
|
||||
|
||||
class pointerTest {
|
||||
public:
|
||||
pointerTest() : m_circle(2) {}
|
||||
const circle * getCircle(int index) const {
|
||||
if (index == 0)
|
||||
return & m_circle;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
circle m_circle;
|
||||
|
||||
};
|
||||
%}
|
Loading…
Reference in New Issue