Skip to content

Commit

Permalink
Merge pull request #41 from tdhock/config-test-file
Browse files Browse the repository at this point in the history
atime_pkg gains tests.R.path arg
tdhock authored Apr 12, 2024
2 parents d09bb8d + d964d85 commit 200f184
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: atime
Type: Package
Title: Asymptotic Timing
Version: 2024.3.5
Version: 2024.4.12
Authors@R: c(
person("Toby", "Hocking",
email="toby.hocking@r-project.org",
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Changes in version 2024.4.12

- atime_pkg gains tests.dir arg.

Changes in version 2024.3.5

- if(requireNamespace("nc")) in tests, thanks CRAN.
4 changes: 2 additions & 2 deletions R/versions.R
Original file line number Diff line number Diff line change
@@ -169,7 +169,7 @@ atime_versions_exprs <- function(pkg.path, expr, sha.vec=NULL, verbose=FALSE, pk
a.args
}

atime_pkg <- function(pkg.path="."){
atime_pkg <- function(pkg.path=".", tests.dir="inst"){
## For an example package see
## https://github.com/tdhock/binsegRcpp/blob/another-branch/inst/atime/tests.R
each.sign.rank <- unit <- . <- N <- expr.name <- reference <- fun.name <-
@@ -211,7 +211,7 @@ atime_pkg <- function(pkg.path="."){
mb.commit <- git2r::merge_base(HEAD.commit, base.commit)
add_if_new("merge-base", mb.commit)
}
tests.R <- file.path(pkg.path, "inst", "atime", "tests.R")
tests.R <- file.path(pkg.path, tests.dir, "atime", "tests.R")
test.env <- new.env()
tests.parsed <- parse(tests.R)
eval(tests.parsed, test.env)
10 changes: 6 additions & 4 deletions man/atime_pkg.Rd
Original file line number Diff line number Diff line change
@@ -4,12 +4,14 @@
\description{Computation time and memory for several R expressions of
several different data sizes, for several package
versions (base, HEAD, CRAN, merge-base, others specified by user).}
\usage{atime_pkg(pkg.path)}
\usage{atime_pkg(pkg.path=".", tests.dir="inst")}
\arguments{
\item{pkg.path}{path to git repository containing R package.}
\item{tests.dir}{path to directory which contains atime/tests.R,
relative to \code{pkg.path} (default \code{"inst"}).}
}
\details{
There should be a file named pkg.path/inst/atime/tests.R which
There should be a \code{tests.R} code file which
defines \code{test.list}, a list with names corresponding to different
tests.
Each element should be a list with at least three named elements: \code{N},
@@ -22,12 +24,12 @@
CRAN is current published version (sha value \code{""}),
merge-base is most recent common ancestor commit between base and
HEAD.
The tests.R file can define \code{version.colors} which should be
The \code{tests.R} code file can define \code{version.colors} which should be
a character vector (names for versions, values for colors).
}
\value{Named list, names come from names of \code{test.list}, and values
come from results of \code{atime_versions}. Side effect is that
data/plot files are saved to the inst/atime directory.}
data/plot files are saved in \code{atime} directory.}

\author{Toby Dylan Hocking}

0 comments on commit 200f184

Please sign in to comment.