Skip to content

Conversation

@FabrizioSandri
Copy link
Owner

This pull request is designed to expand on pull request #5's work to improve the harness creation process.
I decided to revise the harness creation section and make some additional modifications in response to @tdhock's proposals, which are available at tdhock/binsegRcpp#13 (comment).

@FabrizioSandri
Copy link
Owner Author

FabrizioSandri commented Aug 5, 2022

With the most recent commits, I modified the final harness structure by adding two macro definitions: one to prevent input definition duplication and the other to prevent cout duplication.

I provide the automatically generated test harness for testSAN's rcpp_read_out_of_bound function in the code snippet below.

#include <fstream>
#include <RInside.h>
#include <iostream>
#include <RcppDeepState.h>
#include <qs.h>
#include <DeepState.hpp>

RInside Rinstance;

int rcpp_read_out_of_bound(int rbound);

#define INPUTS \
  IntegerVector rbound(1); \
  rbound[0]= RcppDeepState_int(); 

#define PRINT_INPUTS \
  std::cout << "input starts" << std::endl;\
  std::cout << "rbound values: " << rbound << std::endl; \
  std::cout << "input ends" << std::endl;


TEST(testSAN, generator){
  INPUTS
  PRINT_INPUTS
}

TEST(testSAN, runner){
  INPUTS
  PRINT_INPUTS
  qs::c_qsave(rbound,"/home/fabri/test/testHarness/RcppDeepState/inst/testpkgs/testSAN/inst/testfiles/rcpp_read_out_of_bound/inputs/rbound.qs",
		"high", "zstd", 1, 15, true, 1);
  try{
    rcpp_read_out_of_bound(rbound[0]);
  }catch(Rcpp::exception& e){
    std::cout<<"Exception Handled"<<std::endl;
  }
}

@tdhock
Copy link
Collaborator

tdhock commented Aug 5, 2022

looks good!

@FabrizioSandri FabrizioSandri merged commit b2f6a06 into master Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants