Fixed intermittent unit test failures. (#7651)

The problem is that SurfacePoint doesn't have default values when constructed, and a few of the unit tests weren't setting m_position because the values weren't strictly needed for the test. However, the SurfacePointList checks them for validity and asserted when they couldn't be found, which was hit-and-miss due to it being uninitialized memory that was usually but not always 0xCCCCCCCC.
Improved the assert message and set the position values everywhere.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
Mike Balfour
2022-02-15 17:59:04 -06:00
committed by GitHub
parent f2378fc8d8
commit 16d6cbca2a
3 changed files with 21 additions and 13 deletions
@@ -32,7 +32,11 @@ namespace SurfaceData
inPositionIndex = (inPositionIndex + 1) % m_inputPositions.size();
}
AZ_Assert(foundMatch, "Couldn't find input position!");
AZ_Assert(
foundMatch,
"Couldn't find input position: (%0.7f, %0.7f, %0.7f), m_lastInputPositionIndex = %zu, m_inputPositions.size() = %zu",
inPosition.GetX(), inPosition.GetY(), inPosition.GetZ(), m_lastInputPositionIndex, m_inputPositions.size());
m_lastInputPositionIndex = inPositionIndex;
return inPositionIndex;
}