Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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")),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cpp11 (development version)
# cpp11 0.5.3

* Removed non-API usage of `ATTRIB()` (#481).

Expand Down
60 changes: 31 additions & 29 deletions cpp11test/src/test-matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<by_row> attributes are correct") {
auto getExportedValue = cpp11::package("base")["getExportedValue"];

cpp11::doubles_matrix<cpp11::by_row> 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<by_column> attributes are correct") {
auto getExportedValue = cpp11::package("base")["getExportedValue"];

test_that("matrix<by_row> attributes are correct") {
cpp11::doubles_matrix<cpp11::by_row> 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<by_column> attributes are correct") {
cpp11::doubles_matrix<cpp11::by_column> 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<cpp11::by_column> 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") {
Expand Down
2 changes: 1 addition & 1 deletion cpp11test/src/test-strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down