Commit graph

62 commits

Author SHA1 Message Date
Richard Beare
43af20ab3b FIX: references to enums now functioning
There is some consolidation work to be done. The
core of the change is getRClassName2, which will
probably eventually replace getRClassName.

getRClassName seems to be in a funny state, with
a middle argument that is commented out and never
used.

My next step is to verify whether the new version
can replace it.
2019-03-08 21:56:36 +11:00
Richard Beare
4490d0ec2c FIX: Corrected path to output from R tests
Makefile was attempting to cat output files from the
script source directory instead of the build directory.
2019-03-08 21:56:36 +11:00
Richard Beare
62594c611a ENH: Run test for enum_thorough in R
This test exercises many complex cases for enumerations in R.

References to enums currently fail and will be addressed in
the next patch.

Anonymous enums are not supported.

There are some strange corner cases that could be seen as
doing strange things in R. enums are allowed to have the
same underlying integer representation on the C side. This
means that the R structure ends up with two names for the
same integer, which in turn means that the reverse lookup
isn't unique. I don't think this matters. I'll add some
of these cases to the documentation.
2019-03-08 21:56:36 +11:00
William S Fulton
f181d20dd1 Fix overloading for non-pointers and NULL - R 2018-12-30 13:46:51 +00:00
Joseph C Wang
4e8c515d36 add new tests and coercion files for null fix #1124 2017-11-26 03:43:39 +08:00
Joseph C Wang
5525abfea8 add support files and regression tests for #1124 2017-11-25 01:37:14 +08:00
Joseph C Wang
810fb67e4e disable failing enum tests 2017-10-10 17:48:56 +08:00
Joseph C Wang
bff182d556 fix #697 - miscounting comma in member lists
fix method for counting comma in member list
2016-11-12 00:23:41 +08:00
William S Fulton
f2d4e2ea0d Display Rout file when R test case fails
To aid debugging
2016-05-08 00:08:10 +01:00
Richard Beare
f7b794a4f3 run test and copying typemaps to std::string 2016-04-05 10:06:42 +10:00
Richard Beare
351e21bd4a Added a run test for vector types. Tests creation of a std::vector
from and R vector and transparent conversion of the result.
2016-03-15 12:15:29 +11:00
Richard Beare
5c2cd32795 Corrected the testing in unittest so that all elements of
a vector result are checked. Previously it was just the first
element.
2016-03-15 12:14:20 +11:00
William S Fulton
ca64b06229 Consistent quoting in Makefile 2015-08-21 22:48:34 +01:00
William S Fulton
c0bee5bf18 Remove R test until fixed
Fix is in progress, see Github patch #500
2015-08-13 06:47:09 +01:00
Richard Beare
1a6d952094 runtime test for tricky enumerations and support for out of source testing via args option to R 2015-08-12 18:33:53 +01:00
Joseph C Wang
834a93f449 Revert "Merge pull request #494 from richardbeare/enumR2015B"
This reverts commit cb8973f313, reversing
changes made to ac3284f78c.
2015-08-11 09:57:57 +08:00
Richard Beare
da1c6c60d3 This is a modification to support use of tricky enumerations in R. It
includes the addition of a _runme for an existing test - preproc_constants
that was previously not run. That tests includes a preprocessor based
setting of an enumeration which is ignored by the existing r enumeration
infrastructure. The new version correctly reports the enumeration value
as 4 - previous versions set it to 0. Traditional enumerations are unchanged.

The approach used to deal with these enumerations is similar to that of
other languages, and requires a call to a C function at runtime to return
the enumeration value. The previous approach figured out the values statically
and this is still used where possible. The need for a runtime call leads to
changes in when swig code is used in packages - see below.

One test that previously passed now fails - namely the R sourcing of
preproc_constants.R, as the enumeration code requires the shared library,
which isn't loaded by that script.

There is also a modification to the way the R _runme.R files are used.
The call to R CMD BATCH now includes a --args option that indicates
the source folder for the unittest.R file, and the first couple
of lines of the _runme.R files deal with correctly locating this.
Out of source tests now run correctly.

This work was motivated by problems generating the SimpleITK binding,
specifically with some of the more complex enumerations.

This approach does have some issues wrt to code in packages, but I can't
see an alternative. The problem with packages is that the R code setting
up the enumeration structures requires the shared library so that the C
functions returning enumeration values can be called. The enumeration
setup code thus needs to be moved to the package initialisation section.
For SimpleITK I do this using an R script, which I think is an acceptable
solution. The core part of the process is the following function. I dump
all the enumeration stuff into a .onload function. This is only necessary
if some of the enumerations are tricky.

splitSwigFile <- function(filename, onloadfile, mainfile)
{
p1 <- parse(file=filename)

getdefineEnum <- function(X)
{
return (is.call(X) & (X[[1]]=="defineEnumeration"))
}

dd <- sapply(p1, getdefineEnum)

enums <- p1[dd]
enums <- unlist(lapply(enums, deparse))

enums <- c(".onLoad <- function(libname, pkgname) {", enums, "}")

everythingelse <- p1[!dd]
everythingelse <- unlist(lapply(everythingelse, deparse))
writeLines(everythingelse, mainfile)
writeLines(enums, onloadfile)

}
2015-08-10 09:37:04 +10:00
Karl Wette
3fe1eb7056 Set SRCDIR when calling test-suite clean targets, in case it's needed 2014-05-29 02:29:27 +02:00
William S Fulton
28c3549e43 Partially fix R out of source test-suite
Fix when there is NOT a runme.R file
2014-05-15 23:11:07 +01:00
William S Fulton
beccd3258f Update all languages to use SCRIPTDIR
R also to use SCRIPTPREFIX and SCRIPTSUFFIX
2014-05-15 23:11:07 +01:00
William S Fulton
2b5499a262 Slight simplification of test-suite build for new out-of-source changes
Provide default SRCDIR and SCRIPTDIR variables in common.mk and override
only where needed.
2014-05-15 23:11:07 +01:00
Karl Wette
f574a34155 Allow examples and test-suite to be built out of source tree
- Examples/Makefile.in rules use SRCDIR as the relative source directory

- ./config.status replicates Examples/ source directory tree in build
  directory, and copies each Makefile to build directory, prefixed with
  a header which sets SRCDIR to source directory

- Examples/test-suite/.../Makefile.in set SRCDIR from Autoconf-set srcdir

- Examples/test-suite/errors/Makefile.in needs to filter out source
  directory from SWIG error messages

- Lua: embedded interpreters are passed location of run-time test

- Python: copy run-time scripts to build directory because of 2to3
  conversion; import_packages example copies __init__.py from source
  directory; test-suite sets SCRIPTDIR to location of run-time tests

- Javascript: binding.gyp renamed to binding.gyp.in so that $srcdir
  can be substituted with SRCDIR; removed './' from require() statements
  so that NODE_PATH can be used to point Node.js to build directory
2014-05-11 23:21:10 +02:00
Karl Wette
d5b765d388 Whitespace cleanup of all Makefiles*
- some of the %.clean rules in the test-suite Makefiles were using a single tab
  as an empty rule, dangerous! I've replaced these with the safer '@exit 0'.
2014-05-02 20:06:11 +02:00
joequant
e8c6384f77 add regression tests for SEXP return values 2013-07-14 20:29:37 +08:00
William S Fulton
bee885dfe0 Rename r_base_test to overload_method as it is a useful test for all languages
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12992 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-15 18:10:58 +00:00
William S Fulton
4e3428ff66 One test per line in Makefile
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12991 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-15 17:44:09 +00:00
Joseph Wang
d12e7ecd9e add test to confirm fix to sourceforge 3478922
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12990 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-15 12:54:42 +00:00
Joseph Wang
023d597862 add new test case for r to test scalar/vector conflicts
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12927 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-03-17 18:37:51 +00:00
William S Fulton
f4c74bc500 R - SF #3168676 Fix %rename not working for member variables and methods. Add new simple rename testcase with runtime tests for C# and R
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12432 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-04 23:42:06 +00:00
William S Fulton
1918e2a844 Make R unittests pass failure to the Make system, otherwise failures are masked and won't be seen
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12431 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-02-04 23:40:06 +00:00
Miklos Vajna
451f71d7b1 remove unnecessary extra semicolons in the tesuite
Basically just style cleanup, "fi;" or "fi; \" -> "fi".

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11523 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-09 22:52:08 +00:00
William S Fulton
56c5b52c1d remove unnecessary extra shells being spawned in the test-suite
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11522 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-08-09 22:39:51 +00:00
William S Fulton
9064b08651 better way to provide custom commandline options for individual tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11356 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-07-03 22:23:43 +00:00
Joseph Wang
88e60d75c9 fix change to make compatible with integer framework
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11058 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-12 08:54:36 +00:00
Joseph Wang
2854ceef44 Add regression tests for R
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11057 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-12 07:41:38 +00:00
Joseph Wang
98f992e704 add regression test for integers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11051 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-10 23:30:10 +00:00
William S Fulton
db83e51441 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
2008-11-26 21:35:15 +00:00
William S Fulton
1d2856d820 fix partialcheck-test-suite and parallel make for r, chicken, tcl and php
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10560 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-06-23 20:26:07 +00:00
William S Fulton
f06222b993 Add partialcheck make targets. Also add RUNTOOL, COMPILETOOL and SWIGTOOL variables for invoking tools when running tests, compiling or invoking swig
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10482 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-05-20 21:27:22 +00:00
William S Fulton
69e6f39cfd test more global function pointer variables
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10268 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-27 13:07:26 +00:00
William S Fulton
9029bae5e0 Move funcptr.i from being an R only test to a test for all languages. Modify the test to test function pointers with no arguments, which is a problem for R.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10250 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-13 22:41:34 +00:00
Joseph Wang
1094fcda7b Fix memory overflow. Need to allocate one extra byte for the null
termination for the string


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10248 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-02-12 06:53:35 +00:00
Joseph Wang
8c2b3d9dcd Revert last change
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10139 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-15 02:17:19 +00:00
Joseph Wang
c164443d21 Set to include _wrap
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10138 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-15 02:07:42 +00:00
William S Fulton
083efd15ca Rename dll/shared object name to be the same as the module name for R - _wrap is no longer postfixed to the name
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10130 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-14 22:34:10 +00:00
William S Fulton
8eae1cfb5a Fix warnings
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10121 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-14 21:42:31 +00:00
William S Fulton
35c07c0b67 fix SWIG warnings
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10120 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-14 21:38:35 +00:00
William S Fulton
854f9a3ed3 Add Windows PATH for test-suite
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10116 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-12 22:12:47 +00:00
William S Fulton
7bbf5d66d1 fix typo
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10108 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-11 18:53:54 +00:00
Joseph Wang
783ca15e4e Make clean work better
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10107 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-11-11 05:05:15 +00:00