language-extensions/R/test/src/RExtensionApiTests.cpp
//----------------------------------------------------------------------------------------------
// Name: RExtensionApiTest::GetHandles
//
// Description:
//  Loads library and gets handles to different functions
//  Testing if RExtension is successfully loaded dynamically
//
:GetHandles
Description:
Loads library and gets handles to different functions
Testing if RExtension is successfully loaded dynamically
: GetHandles Description : Loads library and gets handles to different functions Testing if RExtension is successfully loaded dynamically
void RExtensionApiTests::GetHandles()
	{
		std::cout << "Loading the RExtension and getting handles for extension APIs.\n";
		sm_libHandle = Utilities::CrossPlatLoadLibrary(x_RExtensionLibName.c_str());
		ASSERT_TRUE(sm_libHandle != nullptr);
		sm_initFuncPtr = reinterpret_cast<FN_init*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"Init"));
		ASSERT_TRUE(sm_initFuncPtr != nullptr);
		sm_initSessionFuncPtr = reinterpret_cast<FN_initSession*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"InitSession"));
		ASSERT_TRUE(sm_initSessionFuncPtr != nullptr);
		sm_initColumnFuncPtr = reinterpret_cast<FN_initColumn*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"InitColumn"));
		ASSERT_TRUE(sm_initColumnFuncPtr != nullptr);
		sm_initParamFuncPtr = reinterpret_cast<FN_initParam*>(
		Utilities::CrossPlatGetFunctionFromLibHandle(
			sm_libHandle,
			"InitParam"));
		ASSERT_TRUE(sm_initParamFuncPtr != nullptr);
		sm_executeFuncPtr = reinterpret_cast<FN_execute*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"Execute"));
		ASSERT_TRUE(sm_executeFuncPtr != nullptr);
		sm_getResultColumnFuncPtr = reinterpret_cast<FN_getResultColumn*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"GetResultColumn"));
		ASSERT_TRUE(sm_getResultColumnFuncPtr != nullptr);
		sm_getResultsFuncPtr = reinterpret_cast<FN_getResults*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"GetResults"));
		ASSERT_TRUE(sm_getResultsFuncPtr != nullptr);
		sm_getOutputParamFuncPtr = reinterpret_cast<FN_getOutputParam*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"GetOutputParam"));
		ASSERT_TRUE(sm_getOutputParamFuncPtr != nullptr);
		sm_cleanupSessionFuncPtr = reinterpret_cast<FN_cleanupSession*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"CleanupSession"));
		ASSERT_TRUE(sm_cleanupSessionFuncPtr != nullptr);
		sm_cleanupFuncPtr = reinterpret_cast<FN_cleanup*>(
			Utilities::CrossPlatGetFunctionFromLibHandle(
				sm_libHandle,
				"Cleanup"));
		ASSERT_TRUE(sm_cleanupFuncPtr != nullptr);
	}
void RExtensionApiTests :: GetHandles ( ) { std :: cout << " \n " ; sm_libHandle = Utilities :: CrossPlatLoadLibrary ( x_RExtensionLibName . c_str ( ) ) ; ASSERT_TRUE ( sm_libHandle != nullptr ) ; sm_initFuncPtr = reinterpret_cast < FN_init * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_initFuncPtr != nullptr ) ; sm_initSessionFuncPtr = reinterpret_cast < FN_initSession * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_initSessionFuncPtr != nullptr ) ; sm_initColumnFuncPtr = reinterpret_cast < FN_initColumn * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_initColumnFuncPtr != nullptr ) ; sm_initParamFuncPtr = reinterpret_cast < FN_initParam * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_initParamFuncPtr != nullptr ) ; sm_executeFuncPtr = reinterpret_cast < FN_execute * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_executeFuncPtr != nullptr ) ; sm_getResultColumnFuncPtr = reinterpret_cast < FN_getResultColumn * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_getResultColumnFuncPtr != nullptr ) ; sm_getResultsFuncPtr = reinterpret_cast < FN_getResults * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_getResultsFuncPtr != nullptr ) ; sm_getOutputParamFuncPtr = reinterpret_cast < FN_getOutputParam * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_getOutputParamFuncPtr != nullptr ) ; sm_cleanupSessionFuncPtr = reinterpret_cast < FN_cleanupSession * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_cleanupSessionFuncPtr != nullptr ) ; sm_cleanupFuncPtr = reinterpret_cast < FN_cleanup * > ( Utilities :: CrossPlatGetFunctionFromLibHandle ( sm_libHandle , " " ) ) ; ASSERT_TRUE ( sm_cleanupFuncPtr != nullptr ) ; }
Name: RExtensionApiTest::GetHandles
Description:
Loads library and gets handles to different functions
Testing if RExtension is successfully loaded dynamically
Name : RExtensionApiTest :: GetHandles Description : Loads library and gets handles to different functions Testing if RExtension is successfully loaded dynamically