[Rcpp-devel] How to manage testing code for Rcpp based project?

Douglas Bates bates at stat.wisc.edu
Sat Aug 4 18:35:15 CEST 2012

On Sat, Aug 4, 2012 at 11:22 AM, Peng Yu <pengyu.ut at gmail.com> wrote:
> Hi,
> I have trouble in finding a good strategy for organizing test cases to
> have complete coverage for Rcpp based code.
> The example in RcppArmadillo_0.3.2.4/inst/unitTests has some problem
> in the sense that, each file is too large --- if there is a little
> change the whole test file should be run, which takes more time than
> necessary. I think that having a more granular test file organization
> can be beneficial. Also, the test file is not in close proximity to
> the function being tested. This cause inefficient when navigating
> between the testing code and the function to be tested.
> There are many ways in solving these problems in other languages. For
> example, primitive test code can be embedded in the docstring in
> python. I'm wondering if anybody knows the best software engineering
> practice for working with Rcpp code.
> BTW, the test code in RcppArmadillo_0.3.2.4/inst/unitTests can be run
> only after RcppArmadillo is installed. For a developer, he/she does
> not always want to install the package before he/she can run the test
> case. "devtools" solves this problem for pure R package. I'm wondering
> if there is any equivalent thing for Rcpp based packages.

Because Rcpp-based packages are testing interfaces to compiled code,
they must either be installed or use the inline package to compile the
code on the fly.  Either approach is going to be slow.

As far as I know, it is still not possible to use the testthat
package, which is what devtools expects for a test harness, with
inline.  There are (or were) conflicting ideas of what the current
working directory is.
> Thanks!
> --
> Regards,
> Peng
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

More information about the Rcpp-devel mailing list