Skip to content

Commit c9def8e

Browse files
committed
roxygen: restore roxygen unit tests and helpers (single commit)
1 parent 05c888b commit c9def8e

File tree

9 files changed

+234
-0
lines changed

9 files changed

+234
-0
lines changed

cpp11test/R/cpp11.R

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,34 @@ rcpp_release_ <- function(n) {
156156
invisible(.Call(`_cpp11test_rcpp_release_`, n))
157157
}
158158

159+
notroxcpp1_ <- function(x) {
160+
.Call(`_cpp11test_notroxcpp1_`, x)
161+
}
162+
163+
roxcpp2_ <- function(x) {
164+
.Call(`_cpp11test_roxcpp2_`, x)
165+
}
166+
167+
roxcpp3_ <- function(x) {
168+
.Call(`_cpp11test_roxcpp3_`, x)
169+
}
170+
171+
roxcpp4_ <- function(x) {
172+
.Call(`_cpp11test_roxcpp4_`, x)
173+
}
174+
175+
roxcpp5_ <- function(x) {
176+
.Call(`_cpp11test_roxcpp5_`, x)
177+
}
178+
179+
notroxcpp6_ <- function(x) {
180+
.Call(`_cpp11test_notroxcpp6_`, x)
181+
}
182+
183+
roxcpp7_ <- function(x) {
184+
.Call(`_cpp11test_roxcpp7_`, x)
185+
}
186+
159187
cpp11_safe_ <- function(x_sxp) {
160188
.Call(`_cpp11test_cpp11_safe_`, x_sxp)
161189
}
@@ -168,6 +196,26 @@ string_push_back_ <- function() {
168196
.Call(`_cpp11test_string_push_back_`)
169197
}
170198

199+
grow_strings_cpp11_ <- function(n, seed) {
200+
.Call(`_cpp11test_grow_strings_cpp11_`, n, seed)
201+
}
202+
203+
grow_strings_rcpp_ <- function(n, seed) {
204+
.Call(`_cpp11test_grow_strings_rcpp_`, n, seed)
205+
}
206+
207+
grow_strings_manual_ <- function(n, seed) {
208+
.Call(`_cpp11test_grow_strings_manual_`, n, seed)
209+
}
210+
211+
assign_cpp11_ <- function(n, seed) {
212+
.Call(`_cpp11test_assign_cpp11_`, n, seed)
213+
}
214+
215+
assign_rcpp_ <- function(n, seed) {
216+
.Call(`_cpp11test_assign_rcpp_`, n, seed)
217+
}
218+
171219
sum_dbl_for_ <- function(x) {
172220
.Call(`_cpp11test_sum_dbl_for_`, x)
173221
}
@@ -236,6 +284,14 @@ rcpp_push_and_truncate_ <- function(size_sxp) {
236284
.Call(`_cpp11test_rcpp_push_and_truncate_`, size_sxp)
237285
}
238286

287+
nullable_extptr_1 <- function() {
288+
.Call(`_cpp11test_nullable_extptr_1`)
289+
}
290+
291+
nullable_extptr_2 <- function() {
292+
.Call(`_cpp11test_nullable_extptr_2`)
293+
}
294+
239295
test_destruction_inner <- function() {
240296
invisible(.Call(`_cpp11test_test_destruction_inner`))
241297
}

cpp11test/man/roxcpp2_.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp11test/man/roxcpp3_.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp11test/man/roxcpp4_.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp11test/man/roxcpp5_.Rd

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp11test/man/roxcpp7_.Rd

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cpp11test/src/roxygen1.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "cpp11/doubles.hpp"
2+
using namespace cpp11;
3+
4+
// Test: not documented + documented
5+
6+
// Not Roxygenised C++ function I
7+
[[cpp11::register]] double notroxcpp1_(double x) {
8+
double y = x + 1.0;
9+
return y;
10+
}
11+
12+
/* roxygen start
13+
@title Roxygenise C++ function II
14+
@param x numeric value
15+
@description Dummy function to test roxygen2. It adds 2.0 to a double.
16+
@export
17+
@examples roxcpp2_(1.0)
18+
roxygen end */
19+
[[cpp11::register]] double roxcpp2_(double x) {
20+
double y = x + 2.0;
21+
return y;
22+
}

cpp11test/src/roxygen2.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "cpp11/doubles.hpp"
2+
using namespace cpp11;
3+
4+
// Test: documented + documented
5+
6+
/* roxygen start
7+
@title Roxygenise C++ function III
8+
@param x numeric value
9+
@description Dummy function to test roxygen2. It adds 3.0 to a double.
10+
@export
11+
@examples roxcpp3_(1.0)
12+
roxygen end */
13+
[[cpp11::register]] double roxcpp3_(double x) {
14+
double y = x + 3.0;
15+
return y;
16+
}
17+
18+
/* roxygen start
19+
@title Roxygenise C++ function IV
20+
@param x numeric value
21+
@description Dummy function to test roxygen2. It adds 4.0 to a double.
22+
@export
23+
@examples roxcpp4_(1.0)
24+
roxygen end */
25+
[[cpp11::register]] double roxcpp4_(double x) {
26+
double y = x + 4.0;
27+
return y;
28+
}

cpp11test/src/roxygen3.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include "cpp11/doubles.hpp"
2+
using namespace cpp11;
3+
4+
// Test: documented + not documented + documented
5+
6+
/* roxygen start
7+
@title Roxygenise C++ function V
8+
@param x numeric value
9+
@description Dummy function to test roxygen2. It adds 5.0 to a double.
10+
@export
11+
@examples roxcpp5_(1.0)
12+
roxygen end */
13+
[[cpp11::register]] double roxcpp5_(double x) {
14+
double y = x + 5.0;
15+
return y;
16+
}
17+
18+
// Not Roxygenised C++ function VI
19+
[[cpp11::register]] double notroxcpp6_(double x) {
20+
double y = x + 6.0;
21+
return y;
22+
}
23+
24+
/* roxygen start
25+
@title Roxygenise C++ function VII
26+
@param x numeric value
27+
@description Dummy function to test roxygen2. It adds 7.0 to a double.
28+
@export
29+
@examples
30+
my_fun <- function(x) {
31+
roxcpp7_(x)
32+
}
33+
@seealso \code{\link{roxcpp1_}}
34+
roxygen end */
35+
[[cpp11::register]] double roxcpp7_(double x) {
36+
double y = x + 7.0;
37+
return y;
38+
}

0 commit comments

Comments
 (0)