language-extensions/R/test/src/RExtensionExecuteTests.cpp
//----------------------------------------------------------------------------------------------
// Name: RExtensionApiTest::ExecuteNumeric
//
// Description:
//  Calls Execute with default script that assigns Input to Output for numeric/decimal types.
//  It checks the correctness of the:
//   1. Executed script,
//   2. InputDataSet and
//   3. OutputDataSet
//
:ExecuteNumeric
Description:
Calls Execute with default script that assigns Input to Output for numeric/decimal types.
It checks the correctness of the:
1. Executed script,
2.
: ExecuteNumeric Description : Calls Execute with default script that assigns Input to Output for numeric / decimal types . It checks the correctness of the : 1 . Executed script 2 .
void RExtensionApiTests::ExecuteNumeric(
		SQLULEN                   rowsNumber,
		void                      **dataSet,
		SQLINTEGER                **strLen_or_Ind,
		vector<string>            columnNames,
		vector<vector<SQLDOUBLE>> expectedDataSet)
	{
		testing::internal::CaptureStdout();
		SQLUSMALLINT outputschemaColumnsNumber = 0;
		SQLRETURN result = (*sm_executeFuncPtr)(
			*m_sessionId,
			m_taskId,
			rowsNumber,
			dataSet,
			strLen_or_Ind,
			&outputschemaColumnsNumber);
		ASSERT_EQ(result, SQL_SUCCESS);
		string output = testing::internal::GetCapturedStdout();
		cout << output;
		ASSERT_TRUE(output.find(m_printMessage) != string::npos);
		 Test InputDataSet
		Rcpp::DataFrame inputDataSet = m_globalEnvironment[m_inputDataNameString.c_str()];
		for (SQLUSMALLINT columnNumber = 0; columnNumber < columnNames.size(); ++columnNumber)
		{
			Rcpp::NumericVector column = inputDataSet[columnNames[columnNumber].c_str()];
			CheckRVectorColumnDataEquality<SQLDOUBLE, Rcpp::NumericVector, SQL_C_DOUBLE>(
				rowsNumber,
				column,
				expectedDataSet[columnNumber].data(),
				strLen_or_Ind[columnNumber]);
		}
		 Test OutputDataSet
		Rcpp::DataFrame outputDataSet = m_globalEnvironment[m_outputDataNameString.c_str()];
		EXPECT_EQ(outputschemaColumnsNumber, outputDataSet.size());
		CheckDataFrameEquality<Rcpp::NumericVector>(
			outputDataSet,
			inputDataSet);
	}
void RExtensionApiTests :: ExecuteNumeric ( SQLULEN rowsNumber , void * * dataSet , SQLINTEGER * * strLen_or_Ind , vector < string > columnNames , vector < vector < SQLDOUBLE > > expectedDataSet ) { testing :: internal :: CaptureStdout ( ) ; SQLUSMALLINT outputschemaColumnsNumber = 0 ; SQLRETURN result = ( * sm_executeFuncPtr ) ( * m_sessionId , m_taskId , rowsNumber , dataSet , strLen_or_Ind , & outputschemaColumnsNumber ) ; ASSERT_EQ ( result , SQL_SUCCESS ) ; string output = testing :: internal :: GetCapturedStdout ( ) ; cout << output ; ASSERT_TRUE ( output . find ( m_printMessage ) != string :: npos ) ; Rcpp :: DataFrame inputDataSet = m_globalEnvironment [ m_inputDataNameString . c_str ( ) ] ; for ( SQLUSMALLINT columnNumber = 0 ; columnNumber < columnNames . size ( ) ; ++ columnNumber ) { Rcpp :: NumericVector column = inputDataSet [ columnNames [ columnNumber ] . c_str ( ) ] ; CheckRVectorColumnDataEquality < SQLDOUBLE , Rcpp :: NumericVector , SQL_C_DOUBLE > ( rowsNumber , column , expectedDataSet [ columnNumber ] . data ( ) , strLen_or_Ind [ columnNumber ] ) ; } Rcpp :: DataFrame outputDataSet = m_globalEnvironment [ m_outputDataNameString . c_str ( ) ] ; EXPECT_EQ ( outputschemaColumnsNumber , outputDataSet . size ( ) ) ; CheckDataFrameEquality < Rcpp :: NumericVector > ( outputDataSet , inputDataSet ) ; }
Name: RExtensionApiTest::ExecuteNumeric
Description:
Calls Execute with default script that assigns Input to Output for numeric/decimal types.
Name : RExtensionApiTest :: ExecuteNumeric Description : Calls Execute with default script that assigns Input to Output for numeric / decimal types .
// Test print message was printed correctly // // Test InputDataSet // // Test OutputDataSet //