mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
ULT renaming: Pointer Math tests
Related-To: NEO-2236 Change-Id: I9797cd0387e80f4797d4111ef35ef3da71236bc4 Signed-off-by: Adam Cetnerowski <adam.cetnerowski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
5a0f70a73c
commit
0ffa1f4314
@ -9,7 +9,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(PtrMath, ptrOffset) {
|
||||
TEST(PtrMath, WhenUsingPtrOffsetThenReturnBasePointerPlusOffset) {
|
||||
auto addrBefore = (uintptr_t)ptrGarbage;
|
||||
auto ptrBefore = addrBefore;
|
||||
|
||||
@ -20,7 +20,7 @@ TEST(PtrMath, ptrOffset) {
|
||||
EXPECT_EQ(offset, addrAfter - addrBefore);
|
||||
}
|
||||
|
||||
TEST(PtrMath, ptrDiff) {
|
||||
TEST(PtrMath, WhenUsingPtrDiffThenReturnOffsetBetweenTwoPointers) {
|
||||
size_t offset = 0x1234;
|
||||
auto addrBefore = (uintptr_t)ptrGarbage;
|
||||
auto addrAfter = addrBefore + offset;
|
||||
@ -28,7 +28,7 @@ TEST(PtrMath, ptrDiff) {
|
||||
EXPECT_EQ(offset, ptrDiff(addrAfter, addrBefore));
|
||||
}
|
||||
|
||||
TEST(PtrMath, addrToPtr) {
|
||||
TEST(PtrMath, WhenConvertingAddressToPtrThenPtrIsCorrect) {
|
||||
uint32_t addr32Bit = 0x3456;
|
||||
uint64_t addr64Bit = 0xf000000000003456;
|
||||
void *ptr32BitAddr = (void *)((uintptr_t)addr32Bit);
|
||||
@ -53,14 +53,14 @@ TEST(PtrMath, givenCastToUint64FunctionWhenConstPointerIsPassedItIsCalledThenPro
|
||||
EXPECT_EQ(uintAddress, expectedUint64Address);
|
||||
}
|
||||
|
||||
TEST(ptrOffset, preserve64Bit) {
|
||||
TEST(ptrOffset, WhenGettingPtrOffsetThen64BitIsPreserved) {
|
||||
uint64_t ptrBefore = 0x800000000;
|
||||
size_t offset = 0x1234;
|
||||
auto ptrAfter = ptrOffset(ptrBefore, offset);
|
||||
EXPECT_EQ(0x800001234ull, ptrAfter);
|
||||
}
|
||||
|
||||
TEST(ptrDiff, preserve64Bit) {
|
||||
TEST(ptrDiff, WhenGettingPtrDiffThen64BitIsPreserved) {
|
||||
auto ptrAfter = 0x800001234ull;
|
||||
|
||||
auto ptrBefore = ptrDiff(ptrAfter, (size_t)0x1234);
|
||||
|
Reference in New Issue
Block a user