mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Move files between shared/test/common/helpers and shared/test/unit_test/helpersi
unit_test/helpers/cmd_buffer_validator.h -> common/helpers unit_test/helpers/gtest_helpers.h -> common/helpers common/helpers/blit_commands_helper_tests.inl -> unit_test/helpers common/helpers/simd_helper_tests.inl -> unit_test/helpers common/helpers/simd_helper_tests_pvc_and_later.inl -> unit_test/helpers common/helpers/state_base_address_tests.h -> unit_test/helpers Related-To: NEO-6524 Signed-off-by: Warchulski, Jaroslaw <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1b9d50660a
commit
a6c1d9578e
77
shared/test/common/helpers/gtest_helpers.h
Normal file
77
shared/test/common/helpers/gtest_helpers.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <regex>
|
||||
#include <stddef.h>
|
||||
#include <string>
|
||||
|
||||
#define EXPECT_EQ_VAL(a, b) \
|
||||
{ \
|
||||
auto evalA = (a); \
|
||||
auto evalB = (b); \
|
||||
EXPECT_EQ(evalA, evalB); \
|
||||
}
|
||||
|
||||
#define EXPECT_NE_VAL(a, b) \
|
||||
{ \
|
||||
auto evalA = (a); \
|
||||
auto evalB = (b); \
|
||||
EXPECT_NE(evalA, evalB); \
|
||||
}
|
||||
|
||||
#define EXPECT_GT_VAL(a, b) \
|
||||
{ \
|
||||
auto evalA = (a); \
|
||||
auto evalB = (b); \
|
||||
EXPECT_GT(evalA, evalB); \
|
||||
}
|
||||
|
||||
#define EXPECT_EQ_CONST(a, b) \
|
||||
{ \
|
||||
decltype(b) expected = (a); \
|
||||
EXPECT_EQ_VAL(expected, b); \
|
||||
}
|
||||
|
||||
inline bool memoryZeroed(const void *mem, const size_t size) {
|
||||
size_t sizeLeft = (size_t)size;
|
||||
bool memoryZeroed = true;
|
||||
while (--sizeLeft) {
|
||||
uint8_t *pMem = (uint8_t *)mem;
|
||||
if (pMem[sizeLeft] != 0) {
|
||||
memoryZeroed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return memoryZeroed;
|
||||
}
|
||||
|
||||
inline bool hasSubstr(const std::string &str, const std::string &subStr) {
|
||||
return std::string::npos != str.find(subStr);
|
||||
}
|
||||
|
||||
inline bool startsWith(const std::string &str, const std::string &subStr) {
|
||||
return 0 == str.find(subStr, 0);
|
||||
}
|
||||
|
||||
inline bool endsWith(const std::string &str, const std::string &subStr) {
|
||||
if (subStr.size() > str.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 0 == str.compare(str.size() - subStr.size(), subStr.size(), subStr);
|
||||
}
|
||||
|
||||
inline bool isEmpty(const std::string &str) {
|
||||
return str.empty();
|
||||
}
|
||||
|
||||
inline bool containsRegex(const std::string &str, const std::string ®ex) {
|
||||
return std::regex_search(str, std::regex(regex));
|
||||
}
|
||||
Reference in New Issue
Block a user