Skip to content

Commit b705203

Browse files
committed
allow five component dev version numbers (e.g. 1.0.6.7.1)
1 parent 081edd1 commit b705203

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2021-05-27 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/tinytest/cpp/rcppversion.cpp (checkVersion): Allow for more
4+
than four components of a development version number
5+
* inst/tinytest/test_packageversion.R: Idem
6+
* inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Clarify in comment
7+
18
2021-05-13 Dirk Eddelbuettel <[email protected]>
29

310
* DESCRIPTION (Version, Date): Roll minor version

inst/include/Rcpp/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#define RCPP_VERSION Rcpp_Version(1,0,6)
3030
#define RCPP_VERSION_STRING "1.0.6"
3131

32-
// the current source snapshot
32+
// the current source snapshot (using four components, if a fifth is used in DESCRIPTION we ignore it)
3333
#define RCPP_DEV_VERSION RcppDevVersion(1,0,6,7)
3434
#define RCPP_DEV_VERSION_STRING "1.0.6.7"
3535

inst/tinytest/cpp/rcppversion.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Rcpp::List checkVersion(Rcpp::IntegerVector v) {
1010

1111
// ensure that length is four, after possibly appending 0
1212
if (v.size() == 3) v.push_back(0);
13-
if (v.size() != 4) Rcpp::stop("Expect vector with four elements.");
13+
if (v.size() == 4) v.push_back(0);
14+
if (v.size() > 5) Rcpp::stop("Expect vector with up to five elements.");
1415

1516
return Rcpp::List::create(Rcpp::Named("def_ver") = RCPP_VERSION,
1617
Rcpp::Named("def_str") = RCPP_VERSION_STRING,

inst/tinytest/test_packageversion.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ v <- as.integer(unlist(strsplit(pvstr, "\\.")))
2929
## construct a release string from the first three elements, ie "1.0.3" from 1.0.3.1
3030
relstr <- as.character(as.package_version(paste(v[1:3], collapse=".")))
3131

32-
3332
## call C++ function returning list of six values, three each for 'release' and 'dev' version
3433
res <- checkVersion(v)
3534

@@ -41,9 +40,11 @@ expect_equal(res$cur_ver, res$def_ver, info="current computed version equal defi
4140
expect_equal(relstr, res$def_str, info="current computed version equal defined dev string")
4241

4342
## additional checks if we are a dev version
44-
if (length(v) == 4) {
43+
if (length(v) >= 4) {
4544
expect_equal(res$cur_dev_ver, res$def_dev_ver, info="current computed dev version greater equal defined dev version")
45+
}
4646

47+
if (length(v) <= 4) {
4748
## basic check: is #defined string version equal to computed string
4849
expect_equal(pvstr, res$def_dev_str, info="current computed version equal defined dev string")
4950
}

0 commit comments

Comments
 (0)