Skip to content

Commit 8f42a84

Browse files
author
Florian Plaza Oñate
committed
Add unit test
1 parent 18777ed commit 8f42a84

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

inst/unitTests/cpp/Subset.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,13 @@ NumericVector subset_assign_subset5(NumericVector x) {
9292
return y;
9393
}
9494

95+
// [[Rcpp::export]]
96+
NumericVector subset_assign_vector_size_1(NumericVector x, int i) {
97+
NumericVector y(1);
98+
y[0]=i;
99+
100+
x[x < 4] = y;
101+
102+
return x;
103+
}
104+

inst/unitTests/runit.subset.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ if (.runThisTest) {
8484
checkIdentical(subset_assign_subset4(seq(2, 4, 0.2)), c(2L,2L,2L,2L,2L,3L,0L,0L,0L,0L,0L))
8585

8686
checkException(subset_assign_subset5(1:6), msg = "index error")
87+
88+
checkIdentical(subset_assign_vector_size_1(1:6,7), c(7,7,7,4,5,6))
8789
}
8890

8991
}

0 commit comments

Comments
 (0)