check_rcpp.RdExtracts the embedded R and Cpp portions from a cpp file.
check_embedded_r(state) check_cpp(state)
| state | An exercise state, as returned by |
|---|
A child state.
# NOT RUN {
# Example solution cpp
#include
using namespace Rcpp ;
// [[Rcpp::export]]
int answer(){
return 42 ;
}
/*** R
x <- answer()
x
*/
# SCT
ex() %>% check_cpp(.) %>% check_code(., "return//s+42//s+;")
ex() %>% check_embedded_r(.) %>% check_function("answer") %>% check_result()
# }