[Rcpp-devel] Unit Test Question Was: pnorm/qnorm?

Dirk Eddelbuettel edd at debian.org
Wed Sep 12 15:58:01 CEST 2012


On 12 September 2012 at 08:38, Rodney Sparapani wrote:
| On 09/07/2012 12:19 PM, Dirk Eddelbuettel wrote:
| > |>  As a general, looking at the unit test files can be helpful. Here is one for qnorm:
| > |>
| > |>     "runit_qnorm_prob" = list(
| > |>     signature( x = "numeric" ),
| > |>     '
| > |>     NumericVector xx(x) ;
| > |>     return List::create(_["lower"] = qnorm( xx, 0.0, 1.0 ),
| > |>     		_["upper"] = qnorm( xx, 0.0, 1.0, false));
| > |>     ')
| 
| The unit tests are indeed very helpful.  However, I have been trying to
| figure out how the unit tests were developed.  As far as I can see,
| there is nothing in Rcpp nor Rmath.h that actually specifies the
| prototypes like the example above (and I did look, hence my initial

If that were true, the code would compile. The code compiles so ...

And:

   edd at max:~$ grep -r qnorm /usr/local/lib/R/site-library/Rcpp/include/ | wc -l
   10
   edd at max:~$ 

| confusion about the syntax of qnorm).  Were these written simply by
| looking at the R help itself like ?qnorm or were they automated in
| some way?  Thanks

There is no magic pixie dust. Some headers are script-generated, even those
scripts are in SVN.  Some of the p/q/d/r-sugar functions are from macro
expansions as you will see.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list