check_cpp_function_exported: Check whether CPP function was properly exported

View source: R/check-rcpp.R

check_cpp_function_exportedR Documentation

Check whether CPP function was properly exported

Description

This check function uses check_code with an advanced regex pattern.

Usage

check_cpp_function_exported(state, return_type, name, not_exported_msg = NULL)

Arguments

state

A child state that focuses on the cpp portion of an exercise submission.

return_type

A character string denoting the return type of the function that should have been exported.

name

A character string denoting name of the function that should have been exported.

not_exported_msg

An optional character string with a message that is shown if the function was not exported properly.

Examples

## Not run: 
# Example solution cpp
#include <Rcpp.h>
using namespace Rcpp ;

// [[Rcpp::export]]
int answer(){
  return 42 ;
}

/*** R
x <- answer()
x
*/

# SCT
ex() %>% check_cpp() %>% check_cpp_function_exported("int", "answer")

## End(Not run)

datacamp/testwhat.ext documentation built on Aug. 26, 2022, 4:12 p.m.