Skip to content

Commit

Permalink
Add unit tests to check value shift
Browse files Browse the repository at this point in the history
Related-To: NEO-3962
Change-Id: Ia3ba560201dd495a22742ef9fef767d6aa4c35f9
Signed-off-by: Gibala <krzysztof.gibala@intel.com>
  • Loading branch information
kgibala authored and Compute-Runtime-Automation committed Nov 29, 2019
1 parent b1fbced commit 43dd16e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
13 changes: 13 additions & 0 deletions unit_tests/gen11/image_tests_gen11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,16 @@ GEN11TEST_F(gen11ImageTests, givenImageForGen11WhenClearColorParametersAreSetThe

EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
}

using Gen11RenderSurfaceStateDataTests = ::testing::Test;

GEN11TEST_F(Gen11RenderSurfaceStateDataTests, WhenMemoryObjectControlStateIndexToMocsTablesIsSetThenValueIsShift) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;

uint32_t value = 4;
surfaceState.setMemoryObjectControlStateIndexToMocsTables(value);

EXPECT_EQ(surfaceState.TheStructure.Common.MemoryObjectControlState_IndexToMocsTables, value >> 1);
EXPECT_EQ(surfaceState.getMemoryObjectControlStateIndexToMocsTables(), value);
}
13 changes: 13 additions & 0 deletions unit_tests/gen12lp/image_tests_gen12lp.inl
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,16 @@ GEN12LPTEST_F(gen12LpImageTests, givenCompressionEnabledWhenAppendingSurfaceStat
image->appendSurfaceStateParams(&rss);
EXPECT_EQ(expectedCompressionFormat, rss.getCompressionFormat());
}

using Gen12lpRenderSurfaceStateDataTests = ::testing::Test;

GEN12LPTEST_F(Gen12lpRenderSurfaceStateDataTests, WhenMemoryObjectControlStateIndexToMocsTablesIsSetThenValueIsShift) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;

uint32_t value = 4;
surfaceState.setMemoryObjectControlStateIndexToMocsTables(value);

EXPECT_EQ(surfaceState.TheStructure.Common.MemoryObjectControlStateIndexToMocsTables, value >> 1);
EXPECT_EQ(surfaceState.getMemoryObjectControlStateIndexToMocsTables(), value);
}
13 changes: 13 additions & 0 deletions unit_tests/gen9/image_tests_gen9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,16 @@ GEN9TEST_F(gen9ImageTests, appendSurfaceStateParamsDoesNothing) {

EXPECT_EQ(0, memcmp(&surfaceStateBefore, &surfaceStateAfter, sizeof(RENDER_SURFACE_STATE)));
}

using Gen9RenderSurfaceStateDataTests = ::testing::Test;

GEN9TEST_F(Gen9RenderSurfaceStateDataTests, WhenMemoryObjectControlStateIndexToMocsTablesIsSetThenValueIsShift) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;

uint32_t value = 4;
surfaceState.setMemoryObjectControlStateIndexToMocsTables(value);

EXPECT_EQ(surfaceState.TheStructure.Common.MemoryObjectControlState_IndexToMocsTables, value >> 1);
EXPECT_EQ(surfaceState.getMemoryObjectControlStateIndexToMocsTables(), value);
}

0 comments on commit 43dd16e

Please sign in to comment.