diff --git a/DESCRIPTION b/DESCRIPTION index 9e2f8259..111360b6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: cpp11 Title: A C++11 Interface for R's C Interface -Version: 0.5.2.9000 +Version: 0.5.3 Authors@R: c( person("Davis", "Vaughan", email = "davis@posit.co", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-4777-038X")), diff --git a/NEWS.md b/NEWS.md index 73ef971d..74c06422 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# cpp11 (development version) +# cpp11 0.5.3 * Removed non-API usage of `ATTRIB()` (#481). diff --git a/cpp11test/src/test-matrix.cpp b/cpp11test/src/test-matrix.cpp index 39e33938..9d23265a 100644 --- a/cpp11test/src/test-matrix.cpp +++ b/cpp11test/src/test-matrix.cpp @@ -24,37 +24,39 @@ context("matrix-C++") { expect_true(x[1].size() == 2); expect_true(x[1].stride() == 5); } - test_that("matrix dim attributes are correct for read only matrices") { + + test_that("matrix attributes are correct") { + auto getExportedValue = cpp11::package("base")["getExportedValue"]; + + cpp11::doubles_matrix x(getExportedValue("datasets", "volcano")); + + expect_true(x.size() == 5307); + expect_true(x.nrow() == 87); + expect_true(x.ncol() == 61); + expect_true(x.nslices() == 87); + expect_true(x.slice_size() == 61); + expect_true(x.slice_stride() == 87); + expect_true(x.slice_offset(0) == 0); + expect_true(x.slice_offset(1) == 1); + expect_true(x[1].size() == 61); + expect_true(x[1].stride() == 87); + } + + test_that("matrix attributes are correct") { auto getExportedValue = cpp11::package("base")["getExportedValue"]; - test_that("matrix attributes are correct") { - cpp11::doubles_matrix x(getExportedValue("datasets", "volcano")); - - expect_true(x.size() == 5307); - expect_true(x.nrow() == 87); - expect_true(x.ncol() == 61); - expect_true(x.nslices() == 87); - expect_true(x.slice_size() == 61); - expect_true(x.slice_stride() == 87); - expect_true(x.slice_offset(0) == 0); - expect_true(x.slice_offset(1) == 1); - expect_true(x[1].size() == 61); - expect_true(x[1].stride() == 87); - } - test_that("matrix attributes are correct") { - cpp11::doubles_matrix x(getExportedValue("datasets", "volcano")); - - expect_true(x.size() == 5307); - expect_true(x.nrow() == 87); - expect_true(x.ncol() == 61); - expect_true(x.nslices() == 61); - expect_true(x.slice_size() == 87); - expect_true(x.slice_stride() == 1); - expect_true(x.slice_offset(0) == 0); - expect_true(x.slice_offset(1) == 87); - expect_true(x[1].size() == 87); - expect_true(x[1].stride() == 1); - } + cpp11::doubles_matrix x(getExportedValue("datasets", "volcano")); + + expect_true(x.size() == 5307); + expect_true(x.nrow() == 87); + expect_true(x.ncol() == 61); + expect_true(x.nslices() == 61); + expect_true(x.slice_size() == 87); + expect_true(x.slice_stride() == 1); + expect_true(x.slice_offset(0) == 0); + expect_true(x.slice_offset(1) == 87); + expect_true(x[1].size() == 87); + expect_true(x[1].stride() == 1); } test_that("row based subsetting works") { diff --git a/cpp11test/src/test-strings.cpp b/cpp11test/src/test-strings.cpp index 59fdb1eb..52ed18fb 100644 --- a/cpp11test/src/test-strings.cpp +++ b/cpp11test/src/test-strings.cpp @@ -251,9 +251,9 @@ context("strings-C++") { test_that("strings::operator=() and strings::at() do compile") { cpp11::writable::strings x(Rf_mkChar("foo")); - x[0] = "bar"; x.at(0) = "bar"; + expect_true(x[0] == Rf_mkChar("bar")); } test_that("strings::operator=() works with std:strings") {