R packages (installed by calling install.packages('package-name')
)
- RUnit
- gmp
- sfsmisc
Rscript test.R
The directory structure is as follows:
docs/XXXX.md
docs/XXXX.md
is a markdown file that contains the actual problem
definition (from Project Euler) and any documentation I thought might be helpful
for those looking at the code.
src/XXXX.R
src/XXXX.R
must contain a function called problemX
(problem1, problem99, etc.) that returns the desired result (i.e., the answer to
the problem).
tests/XXXX.R
tests/XXXX.R
is an R source file which must contain a function
called test.problemX
(test1, test99, etc.) that tests the result of
the problemX
function for correctness.
To have the test run as part of the RUnit test suite, this test must be added to
the test suite in test.R
in the root directory.
We have provided a function, test.wrapper
, to encapsulate testing
the correctness of the result and the time taken to get the result (Project
Euler specifies that this should be less than one minute).
RUnit
Check this out: Unit Testing in R: The Bare Minimum