Minor refactoring related to residency task count

Change-Id: I49c9a5b37637e19fa12b7e6d91c352fb78bb117a
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2018-12-18 13:02:08 +00:00
committed by sys_ocldev
parent 068582445d
commit b138ff5750
4 changed files with 27 additions and 5 deletions

View File

@@ -84,9 +84,31 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedResidencyTaskCoun
TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenResetResidencyTaskCountThenAllocationIsNotResident) {
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.updateResidencyTaskCount(1, 0u);
graphicsAllocation.updateResidencyTaskCount(1u, 0u);
EXPECT_TRUE(graphicsAllocation.isResident(0u));
graphicsAllocation.resetResidencyTaskCount(0u);
EXPECT_FALSE(graphicsAllocation.isResident(0u));
}
TEST(GraphicsAllocationTest, givenNonResidentGraphicsAllocationWhenCheckIfResidencyTaskCountIsBelowAnyValueThenReturnTrue) {
MockGraphicsAllocation graphicsAllocation;
EXPECT_FALSE(graphicsAllocation.isResident(0u));
EXPECT_TRUE(graphicsAllocation.isResidencyTaskCountBelow(0u, 0u));
}
TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenCheckIfResidencyTaskCountIsBelowCurrentResidencyTaskCountThenReturnFalse) {
MockGraphicsAllocation graphicsAllocation;
auto currentResidencyTaskCount = 1u;
graphicsAllocation.updateResidencyTaskCount(currentResidencyTaskCount, 0u);
EXPECT_TRUE(graphicsAllocation.isResident(0u));
EXPECT_FALSE(graphicsAllocation.isResidencyTaskCountBelow(currentResidencyTaskCount, 0u));
}
TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenCheckIfResidencyTaskCountIsBelowHigherThanCurrentResidencyTaskCountThenReturnTrue) {
MockGraphicsAllocation graphicsAllocation;
auto currentResidencyTaskCount = 1u;
graphicsAllocation.updateResidencyTaskCount(currentResidencyTaskCount, 0u);
EXPECT_TRUE(graphicsAllocation.isResident(0u));
EXPECT_TRUE(graphicsAllocation.isResidencyTaskCountBelow(currentResidencyTaskCount + 1u, 0u));
}