Skip to content

Commit e2f53f4

Browse files
+ test nrow
1 parent 60c6284 commit e2f53f4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

inst/unitTests/cpp/Matrix.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ NumericMatrix runit_no_init_matrix_ctor() {
288288
return x;
289289
}
290290

291+
// [[Rcpp::export]]
292+
int runit_no_init_matrix_ctor_nrows() {
293+
NumericMatrix x(no_init(2, 2));
294+
return x.nrow();
295+
}
296+
291297
void runit_const_Matrix_column_set( NumericMatrix::Column& col1, const NumericMatrix::Column& col2 ){
292298
col1 = col2 ;
293299
}

inst/unitTests/runit.Matrix.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ if (.runThisTest) {
202202
checkEquals(m, matrix(c(0, 1, 2, 3), nrow = 2))
203203
}
204204

205+
test.NumericMatrix.no.init.ctor.nrow <- function() {
206+
nrow <- runit_no_init_matrix_ctor_nrow()
207+
checkEquals(nrow, 2L)
208+
}
209+
205210
test.NumericMatrix.const.Column <- function(){
206211
m <- matrix(as.numeric(1:9), nrow = 3)
207212
res <- runit_const_Matrix_column(m)

0 commit comments

Comments
 (0)