[Bioc-devel] unit tests for C code inside a package

Dan Tenenbaum dtenenba at fredhutch.org
Mon Jan 26 19:14:44 CET 2015



----- Original Message -----
> From: "Elena Grassi" <grassi.e at gmail.com>
> To: bioc-devel at r-project.org
> Sent: Monday, January 26, 2015 1:14:59 AM
> Subject: [Bioc-devel] unit tests for C code inside a package
> 
> Hi,
> 
> I'm writing a package that calculates total affinity (see PMID
> 21335606 and 16873464 if transcription factors are your thing):
> up until now in our lab we've used a pure C tool that needs fasta and
> tabular formatted PFM-PWM files but we are willing to produce
> something more comfortable that stems from some related Bioc packages
> (TFBSTools and JASPAR2014 basically).
> The package has two simple R methods that call a C entry point and
> then all the calculations are performed by the C code.
> I'd like to write extended unit tests but I am not sure how to do it:
> I've some tests for the R portions (that obviously depends
> also on the C calculation in some parts) but I would like to test in
> a
> more fine grained way the C code therefore RUnit and BiocGenerics
> seems to solve only a portion of my problem. I would like to use a
> C-based library for unit testing and link it to the automatic
> check done for the package thanks to BiocGenerics: is this
> reasonable?
> I've looked at some other packages without being able to find
> something similar to this.
> I've read
> http://stackoverflow.com/questions/26322135/unit-testing-rcpp-code-in-a-package,
> but I think
> that it would be nice to test the C code with the whole package.
> 

Choose a C-based unit-testing library, include it with your package, write a C function that calls your test suite, register that function to be callable from R, and call it from an R unit test?

Dan


> Thanks,
> E.
> ps. the source code right now is here:
> https://github.com/vodkatad/MatrixRider (the vignette is on its way,
> the nodevel branch is the one active now and it works with R version
> 3.1.2 and Bioconductor 3.0 for our internal use).
> 
> --
> $ pom
> 
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>



More information about the Bioc-devel mailing list