diff --git a/.github/workflows/RcppDeepState.yaml b/.github/workflows/RcppDeepState.yaml new file mode 100644 index 0000000..525a324 --- /dev/null +++ b/.github/workflows/RcppDeepState.yaml @@ -0,0 +1,24 @@ +on: + pull_request: + branches: + - '*' + +name: 'RcppDeepState analysis' +jobs: + RcppDeepState: + runs-on: ubuntu-latest + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: FabrizioSandri/RcppDeepState-action@main + with: + fail_ci_if_error: true + seed: 5 + time_limit_seconds: 60 + max_inputs: 100 + comment: true + verbose: true diff --git a/inst/testfiles/binseg_interface/binseg_interface_DeepState_TestHarness.cpp b/inst/testfiles/binseg_interface/binseg_interface_DeepState_TestHarness.cpp new file mode 100644 index 0000000..b6b4de5 --- /dev/null +++ b/inst/testfiles/binseg_interface/binseg_interface_DeepState_TestHarness.cpp @@ -0,0 +1,53 @@ +#include +#include +#include +#include +#include +#include + +RInside Rinstance; + +/** FUNCTION SIGNATURE */ +Rcpp::List binseg_interface(const Rcpp::NumericVector data_vec, const Rcpp::NumericVector weight_vec, +const int max_segments, const int min_segment_length, const std::string distribution_str, +const std::string container_str, const Rcpp::LogicalVector is_validation_vec, const Rcpp::NumericVector position_vec); + +Rcpp::LogicalVector RcppDeepState_LogicalVector(int rand_size){ + Rcpp::LogicalVector rand_vec(rand_size); + for(int i = 0 ; i < rand_size;i++){ + rand_vec[i] = DeepState_IntInRange(0,1); + } + + return rand_vec; +} + +#define INPUTS \ + int n_data = DeepState_IntInRange(1,1000); \ + Rcpp::NumericVector data_vec = RcppDeepState_NumericVector(n_data, 0, 1000); \ + Rcpp::NumericVector weight_vec = RcppDeepState_NumericVector(n_data, 0, 1000); \ + int max_segments = RcppDeepState_int(1, n_data); \ + int min_segment_length = RcppDeepState_int(1, 10); \ + std::string distribution_str = "test"; \ + std::string container_str = "test"; \ + Rcpp::LogicalVector is_validation_vec = RcppDeepState_LogicalVector(n_data); \ + Rcpp::NumericVector position_vec = RcppDeepState_NumericVector(n_data, 0, 1000); + +TEST(binsegRcpp, generator){ + INPUTS +} + +TEST(binsegRcpp, runner){ + INPUTS + + /** INPUTS DUMP + Skipped: the final analysis table will contain an empty inputs column + */ + + try{ + binseg_interface(data_vec, weight_vec, max_segments,min_segment_length, + distribution_str, container_str, is_validation_vec, position_vec); + + }catch(Rcpp::exception& e){ + std::cout<<"Exception Handled"< 0){ + double *unused_ptr = new double[5]; + unused_ptr[0] = data_vec[0]; + } if(weight_vec.size() != n_data){ Rcpp::stop("weight_vec must be same size as data_vec"); }