Skip to content

Commit 871feb4

Browse files
additional test for Matrix<.,NoProtectStorage>
1 parent 52242d4 commit 871feb4

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

inst/unitTests/cpp/Vector.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,3 +772,7 @@ int noprotect_vector( Vector<REALSXP, NoProtectStorage> x){
772772
return x.size() ;
773773
}
774774

775+
// [[Rcpp::export]]
776+
int noprotect_matrix( Matrix<REALSXP, NoProtectStorage> x){
777+
return x.nrow() ;
778+
}

inst/unitTests/runit.Vector.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,5 +679,10 @@ if (.runThisTest) {
679679
checkIdentical( noprotect_vector(x), 10L )
680680
}
681681

682+
test.noprotect_matrix <- function(){
683+
x <- matrix(rnorm(10), nrow=2)
684+
checkIdentical( noprotect_matrix(x), 2L )
685+
}
686+
682687
}
683688

0 commit comments

Comments
 (0)