R packages and test code

A.J. Rossini rossini@biostat.washington.edu
15 Mar 1999 10:35:39 -0800

>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> writes:
>>>>> "tony" == A J Rossini <rossini@biostat.washington.edu> writes:

    tony> Where is the best place to put evaluation/test code in
    tony> creating an R package?  I thought about a test subdirectory,
    tony> but might it be better to put in the R directory?  I guess
    tony> I'm more concerned about the output used for evaluating the
    tony> success of the test, rather than the test code and data,
    tony> itself.

    MM> Good question.  This hasn't been done yet in a formal general
    MM> way.  MASS comes with the scripts subdirectory, but there's no
    MM> "make check" and comparison of desired and actual output.

Is there a more formal description of the packaging system than that
given in the R-faq (which needs a bit of an update for ESS, Kurt)?

(I'd like to see one, if so, in order to specify exactly how to
consider the general situation).

    MM> 2) I assume the thing you desire is something like
    MM>    what the distributed R does in ./tests/ where there are
    MM>    foobar.R and foobar.Rout.save files
    MM> 	     for (foobar in c("is-things", "simple-tests",
    MM> 	     "eval-etc",
    MM> 			      ...)) :
    MM>       R --vanilla < foobar.R > foobar.Rout
    MM>    is run and a somewhat "tolerant" diff between foobar.Rout
    MM>    and foobar.Rout.save is made. "SUCCESS" (actually `Ok') is
    MM>    reported when there are no (nontrivial) diffs.

Yes, but not quite as formal as checking for non-trivial diffs.  I'd
be satisfied with just being able to construct a diff (or the new
file, to compare with the gold standard, for the diff) and making the
user visually go over them.

    MM> Tony, could you try to add this feature (to the relevant R
    MM> scripts) yourself?  or anyone else?  [it would be nice of
    MM> course, if the identical scripts were used for
    MM>  "base R"'s ``make check'' and for the contributed packages's
    MM>  "R CMD check .. pkg" or (preferably) "R INSTALL pkg ..."
    MM> ]

I can try, since I really want this (the tests, and quite possibly the
packaging specification for my next stat language project :-).
Probably won't happen until after my Vienna/Berlin/Atlanta trips over
the next 2+ weeks...


A.J. Rossini
UW Biostatistics & Center for AIDS Research 
206-543-1044 / 206-720-4282                 
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch