language-extensions/R/test/src/RExtensionExecuteTests.cpp
//----------------------------------------------------------------------------------------------
// Name: ExecuteNumericColumnsTest
//
// Description:
//  Tests Execute with default script using an InputDataSet of numeric columns.
//
ExecuteNumericColumnsTest
Description:
Tests Execute with default script using an InputDataSet of numeric columns.
ExecuteNumericColumnsTest Description : Tests Execute with default script using an InputDataSet of numeric columns .
TEST_F(RExtensionApiTests, ExecuteNumericColumnsTest)
	{
		unique_ptr<ColumnInfo<SQL_NUMERIC_STRUCT>> numericInfo =
			make_unique<ColumnInfo<SQL_NUMERIC_STRUCT>>(
				"NumericColumn1",
				vector<SQL_NUMERIC_STRUCT>{
					{ 38, 0, 1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 134, 90, 168, 76, 59, 75 } },
					{ 38, 0, 0, { 0, 0, 0, 0, 0, 2, 37, 62, 94, 206, 79, 32, 0, 0, 0, 0 } },
					{ 38, 0, 1, { 0, 0, 100, 167, 179, 182, 224, 13, 0, 0, 0, 0, 0, 0, 0, 0 } },
					{ 38, 0, 1, { 0, 225, 245, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
					{ 38, 0, 1, { 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0 } },
				},
				vector<SQLINTEGER>{ 38, 38, 38, 38, 38 },
				"NumericColumn2",
				vector<SQL_NUMERIC_STRUCT>{
					{ 38, 19, 1, { 56, 0, 100, 167, 179, 182, 224, 13, 0, 0, 0, 0, 0, 0, 0, 0 } },
					{ 38, 19, 1, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
					{ 38, 19, 0, { 64, 80, 202, 198, 156, 52, 198, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
					{ 38, 19, 1, { 0, 0, 176, 116, 212, 184, 7, 112, 46, 1, 0, 0, 0, 0, 0, 0 } },
					{}
				},
				vector<SQLINTEGER>{ 38, 38, 38, 38, SQL_NULL_DATA },
				vector<SQLSMALLINT>{ SQL_NO_NULLS, SQL_NULLABLE });
		vector<vector<SQLDOUBLE>> expectedDataSet = {
			{ 1e38, -1e28, 1e18, 1e8, 18446744073709551616.0 },
			{ 999999999999999999e-19, 1e-19, -0.0055789893343400000, 557.8989334339999760384, 0 }
		};
		 Initialize with a default Session that prints Hello RExtension
		 and assigns InputDataSet to OutputDataSet
		InitializeSession(numericInfo->GetColumnsNumber(),
			m_scriptString,
			0);  parametersNumber
		InitializeColumns<SQL_NUMERIC_STRUCT, SQL_C_NUMERIC>(numericInfo.get());
		ExecuteNumeric(
			ColumnInfo<SQL_NUMERIC_STRUCT>::sm_rowsNumber,
			numericInfo->m_dataSet.data(),
			numericInfo->m_strLen_or_Ind.data(),
			numericInfo->m_columnNames,
			expectedDataSet);
	}
TEST_F ( RExtensionApiTests , ExecuteNumericColumnsTest ) { unique_ptr < ColumnInfo < SQL_NUMERIC_STRUCT > > numericInfo = make_unique < ColumnInfo < SQL_NUMERIC_STRUCT > > ( " " , vector < SQL_NUMERIC_STRUCT > { { 38 , 0 , 1 , { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 196 , 134 , 90 , 168 , 76 , 59 , 75 } } , { 38 , 0 , 0 , { 0 , 0 , 0 , 0 , 0 , 2 , 37 , 62 , 94 , 206 , 79 , 32 , 0 , 0 , 0 , 0 } } , { 38 , 0 , 1 , { 0 , 0 , 100 , 167 , 179 , 182 , 224 , 13 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } , { 38 , 0 , 1 , { 0 , 225 , 245 , 5 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } , { 38 , 0 , 1 , { 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } , } , vector < SQLINTEGER > { 38 , 38 , 38 , 38 , 38 } , " " , vector < SQL_NUMERIC_STRUCT > { { 38 , 19 , 1 , { 56 , 0 , 100 , 167 , 179 , 182 , 224 , 13 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } , { 38 , 19 , 1 , { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } , { 38 , 19 , 0 , { 64 , 80 , 202 , 198 , 156 , 52 , 198 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } , { 38 , 19 , 1 , { 0 , 0 , 176 , 116 , 212 , 184 , 7 , 112 , 46 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } } , { } } , vector < SQLINTEGER > { 38 , 38 , 38 , 38 , SQL_NULL_DATA } , vector < SQLSMALLINT > { SQL_NO_NULLS , SQL_NULLABLE } ) ; vector < vector < SQLDOUBLE > > expectedDataSet = { { 1e38 , -1e28 , 1e18 , 1e8 , 18446744073709551616.0 } , { 999999999999999999e-19 , 1e-19 , -0.0055789893343400000 , 557.8989334339999760384 , 0 } } ; InitializeSession ( numericInfo -> GetColumnsNumber ( ) , m_scriptString , 0 ) ; InitializeColumns < SQL_NUMERIC_STRUCT , SQL_C_NUMERIC > ( numericInfo . get ( ) ) ; ExecuteNumeric ( ColumnInfo < SQL_NUMERIC_STRUCT > :: sm_rowsNumber , numericInfo -> m_dataSet . data ( ) , numericInfo -> m_strLen_or_Ind . data ( ) , numericInfo -> m_columnNames , expectedDataSet ) ; }
Name: ExecuteNumericColumnsTest
Description:
Tests Execute with default script using an InputDataSet of numeric columns.
Name : ExecuteNumericColumnsTest Description : Tests Execute with default script using an InputDataSet of numeric columns .
// Expected numeric columns in the input dataset. // // Initialize with a default Session that prints Hello RExtension // and assigns InputDataSet to OutputDataSet // // parametersNumber