From ca7c64bb7f2ea7224f86c47951a31281559f1905 Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Thu, 11 Apr 2024 20:27:47 -0700 Subject: [PATCH 1/4] tests.R.path arg --- R/versions.R | 4 ++-- man/atime_pkg.Rd | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/R/versions.R b/R/versions.R index e7111e2..fe338ea 100644 --- a/R/versions.R +++ b/R/versions.R @@ -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.R.path=file.path("inst", "atime", "tests.R"))){ ## 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.R.path) test.env <- new.env() tests.parsed <- parse(tests.R) eval(tests.parsed, test.env) diff --git a/man/atime_pkg.Rd b/man/atime_pkg.Rd index 76fde74..5154fa4 100644 --- a/man/atime_pkg.Rd +++ b/man/atime_pkg.Rd @@ -7,9 +7,10 @@ \usage{atime_pkg(pkg.path)} \arguments{ \item{pkg.path}{path to git repository containing R package.} + \item{tests.R.path}{path of tests R code file, relative to \code{pkg.path}.} } \details{ - There should be a file named pkg.path/inst/atime/tests.R which + There should be a 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,7 +23,7 @@ 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 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 From a780fc3f0826025e70b2ef67771bd8e37d31abf1 Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Fri, 12 Apr 2024 09:13:36 -0700 Subject: [PATCH 2/4] tests.dir arg --- R/versions.R | 4 ++-- man/atime_pkg.Rd | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/R/versions.R b/R/versions.R index fe338ea..994a8ae 100644 --- a/R/versions.R +++ b/R/versions.R @@ -169,7 +169,7 @@ atime_versions_exprs <- function(pkg.path, expr, sha.vec=NULL, verbose=FALSE, pk a.args } -atime_pkg <- function(pkg.path=".", tests.R.path=file.path("inst", "atime", "tests.R"))){ +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=".", tests.R.path=file.path("inst", "atime", "tes mb.commit <- git2r::merge_base(HEAD.commit, base.commit) add_if_new("merge-base", mb.commit) } - tests.R <- file.path(pkg.path, tests.R.path) + 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) diff --git a/man/atime_pkg.Rd b/man/atime_pkg.Rd index 5154fa4..c1f46fd 100644 --- a/man/atime_pkg.Rd +++ b/man/atime_pkg.Rd @@ -7,10 +7,11 @@ \usage{atime_pkg(pkg.path)} \arguments{ \item{pkg.path}{path to git repository containing R package.} - \item{tests.R.path}{path of tests R code file, relative to \code{pkg.path}.} + \item{tests.dir}{path to directory which contains atime/tests.R, + relative to \code{pkg.path} (default \code{"inst"}).} } \details{ - There should be a tests R code file 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}, @@ -23,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 code 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} From e6fcd4b230dbb311957d673ae11bd33553d319cb Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Fri, 12 Apr 2024 13:51:09 -0700 Subject: [PATCH 3/4] fix \usage --- man/atime_pkg.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/atime_pkg.Rd b/man/atime_pkg.Rd index c1f46fd..6de5590 100644 --- a/man/atime_pkg.Rd +++ b/man/atime_pkg.Rd @@ -4,7 +4,7 @@ \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, From 6f76a76cd39982241b237928671e7d56b2d9182a Mon Sep 17 00:00:00 2001 From: Toby Dylan Hocking Date: Fri, 12 Apr 2024 16:08:13 -0700 Subject: [PATCH 4/4] version+ --- DESCRIPTION | 2 +- NEWS | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3f825ac..51f5401 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: atime Type: Package Title: Asymptotic Timing -Version: 2024.2.13 +Version: 2024.4.12 Authors@R: c( person("Toby", "Hocking", email="toby.hocking@r-project.org", diff --git a/NEWS b/NEWS index 4a2d964..47e9b3d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Changes in version 2024.4.12 + +- atime_pkg gains tests.dir arg. + Changes in version 2024.2.13 - atime_grid gains new argument symbol.params, and more informative error messages.