Skip to content

Commit e79c70e

Browse files
authored
Merge pull request #1163 from RcppCore/feature/five_digit_version
Allow 'five element version' numbers during development
2 parents b4baf27 + b705203 commit e79c70e

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
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/NEWS.Rd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
\item The \code{uint32_t} type is used throughout instead of
2020
\code{unsigned int} (Dirk in \ghpr{1153} fixing \ghit{1152}).
2121
\item The \code{cfloat} header for floating point limits is now
22-
included {\Dirk in \ghpr{1162} fixing \ghit{1161}).
22+
included (Dirk in \ghpr{1162} fixing \ghit{1161}).
2323
}
2424
\item Changes in Rcpp Attributes:
2525
\itemize{
2626
\item Packages with dots in their name can now have per-package
27-
include files (Dirk in \ghpr{1132} fixes \ghit{1129}).
27+
include files (Dirk in \ghpr{1132} fixing \ghit{1129}).
2828
\item New argument \code{echo} to quieten optional evaluation in
2929
\code{sourceCpp} (Dirk in \ghpr{1138} fixing \ghit{1126}).
3030
}

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)