Abort execution when registering invalid sharing object

Change-Id: Ie6091eb659c423ffe5deb4a3ffe55ae0ef66797d
This commit is contained in:
Dunajski, Bartosz
2018-07-04 11:38:43 +02:00
committed by sys_ocldev
parent cf1f60a1b4
commit eead3ec683
2 changed files with 7 additions and 0 deletions

View File

@ -299,6 +299,12 @@ TEST_F(ContextTest, givenContextWhenSharingTableEmptyThenReturnsNullptr) {
EXPECT_EQ(sharingF, nullptr);
}
TEST_F(ContextTest, givenNullptrWhenRegisteringSharingToContextThenAbortExecution) {
MockContext context;
context.clearSharingFunctions();
EXPECT_THROW(context.registerSharing<MockSharingFunctions>(nullptr), std::exception);
}
TEST_F(ContextTest, givenContextWhenSharingTableIsNotEmptyThenReturnsSharingFunctionPointer) {
MockContext context;
MockSharingFunctions *sharingFunctions = new MockSharingFunctions;