Files
compute-runtime/unit_tests/api/cl_add_comment_to_aub_tests.inl
Mrozek, Michal a21f921dcf Do not validate platform for add comment call.
Change-Id: I1f4c28541aea8e13ac1a63511acb5528b3047fe5
Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
2019-04-11 10:25:18 +02:00

58 lines
1.9 KiB
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/platform/platform.h"
#include "unit_tests/api/cl_api_tests.h"
#include "unit_tests/mocks/mock_aub_center.h"
#include "unit_tests/mocks/mock_aub_manager.h"
using namespace NEO;
namespace ULT {
using clAddCommentToAubTest = api_tests;
TEST_F(clAddCommentToAubTest, givenProperCommentNullptrAubCenterWhenAddCommentToAubThenSuccessIsReturned) {
auto retVal = clAddCommentINTEL(pPlatform, "comment");
EXPECT_EQ(CL_SUCCESS, retVal);
}
TEST_F(clAddCommentToAubTest, givenNullptrCommentWhenAddCommentToAubThenErrorIsReturned) {
auto retVal = clAddCommentINTEL(pPlatform, nullptr);
EXPECT_EQ(CL_INVALID_VALUE, retVal);
}
TEST_F(clAddCommentToAubTest, givenAubCenterAndProperCommentButNullptrAubManagerWhenAddCommentToAubThenErrorIsReturned) {
pPlatform->peekExecutionEnvironment()->aubCenter.reset(new MockAubCenter());
auto retVal = clAddCommentINTEL(pPlatform, "comment");
EXPECT_EQ(CL_INVALID_VALUE, retVal);
}
TEST_F(clAddCommentToAubTest, givenProperCommentAubCenterAndAubManagerWhenAddCommentToAubThenSuccessIsReturned) {
struct AubManagerCommentMock : public MockAubManager {
using MockAubManager::MockAubManager;
void addComment(const char *message) override {
addCommentCalled = true;
EXPECT_STREQ("comment", message);
}
bool addCommentCalled = false;
};
auto mockAubCenter = new MockAubCenter();
auto mockAubManager = new AubManagerCommentMock;
mockAubCenter->aubManager.reset(mockAubManager);
pPlatform->peekExecutionEnvironment()->aubCenter.reset(mockAubCenter);
EXPECT_FALSE(mockAubManager->addCommentCalled);
auto retVal = clAddCommentINTEL(pPlatform, "comment");
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_TRUE(mockAubManager->addCommentCalled);
}
} // namespace ULT