Implement GTest and change windows output path

Implement GTest as a testing infrastructure.
Make windows output binaries to the build folder instead of the release type folder (potentially issue further down the line)
Add a simple unit test for DestroyableComponent
This commit is contained in:
David Markowitz
2022-11-07 00:12:35 -08:00
committed by GitHub
parent 9c58ea5c41
commit 1464762bcd
30 changed files with 763 additions and 325 deletions

View File

@@ -138,25 +138,17 @@ void DestroyableComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsIn
if (m_IsSmashable) {
outBitStream->Write(m_HasBricks);
if (m_ExplodeFactor != 1.0f) {
outBitStream->Write1();
outBitStream->Write(m_ExplodeFactor);
} else {
outBitStream->Write0();
}
outBitStream->Write(m_ExplodeFactor != 1.0f);
if (m_ExplodeFactor != 1.0f) outBitStream->Write(m_ExplodeFactor);
}
}
m_DirtyHealth = false;
}
outBitStream->Write(m_DirtyThreatList || bIsInitialUpdate);
if (m_DirtyThreatList || bIsInitialUpdate) {
outBitStream->Write1();
outBitStream->Write(m_HasThreats);
m_DirtyThreatList = false;
} else {
outBitStream->Write0();
}
}
@@ -438,7 +430,6 @@ void DestroyableComponent::AddEnemyFaction(int32_t factionID) {
void DestroyableComponent::SetIsSmashable(bool value) {
m_DirtyHealth = true;
m_IsSmashable = value;
//m_HasBricks = value;
}
void DestroyableComponent::SetAttacksToBlock(const uint32_t value) {

View File

@@ -239,7 +239,7 @@ public:
* Sets the multiplier for the explosion that's visible when the bricks fly out when this entity is smashed
* @param value the multiplier for the explosion that's visible when the bricks fly out when this entity is smashed
*/
void SetExplodeFactor(float value);
void SetExplodeFactor(float value) { m_ExplodeFactor = value; };
/**
* Returns the current multiplier for explosions
@@ -414,6 +414,14 @@ public:
*/
void AddOnHitCallback(const std::function<void(Entity*)>& callback);
/**
* Pushes a faction back to the list of factions.
* @param value Faction to add to list.
*
* This method should only be used for testing. Use AddFaction(int32_t, bool) for adding a faction properly.
*/
void AddFactionNoLookup(int32_t faction) { m_FactionIDs.push_back(faction); };
private:
/**
* Whether or not the health should be serialized