From 6ddf5b3e92cfcc5306ca2d263fb5162da258bd00 Mon Sep 17 00:00:00 2001 From: jadebenn Date: Sat, 20 Apr 2024 00:07:08 -0500 Subject: [PATCH] remove unneeded tests --- .../CDClientTables/CDPetComponentTable.cpp | 2 +- dGame/dComponents/PetComponent.cpp | 3 +- dGame/dComponents/PetComponent.h | 14 ++--- .../dComponentsTests/PetComponentTests.cpp | 54 ------------------- 4 files changed, 6 insertions(+), 67 deletions(-) diff --git a/dDatabase/CDClientDatabase/CDClientTables/CDPetComponentTable.cpp b/dDatabase/CDClientDatabase/CDClientTables/CDPetComponentTable.cpp index 078a5b10..96d4550c 100644 --- a/dDatabase/CDClientDatabase/CDClientTables/CDPetComponentTable.cpp +++ b/dDatabase/CDClientDatabase/CDClientTables/CDPetComponentTable.cpp @@ -54,7 +54,7 @@ void CDPetComponentTable::LoadValuesFromDefaults() { } const CDPetComponent& CDPetComponentTable::GetByID(const uint32_t componentID) { - const auto& entries = GetEntriesMutable(); + const auto& entries = GetEntries(); const auto itr = entries.find(componentID); if (itr == entries.cend()) { LOG("Unable to load pet component (ID %i) values from database! Using default values instead.", componentID); diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index bc64f3be..292d8a3f 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -96,7 +96,8 @@ PetComponent::PetComponent(Entity* parentEntity, uint32_t componentId) : Compone void PetComponent::Serialize(RakNet::BitStream& outBitStream, bool bIsInitialUpdate) { const bool tamed = m_Owner != LWOOBJID_EMPTY; - outBitStream.Write1(); // Always serialize as dirty for now + constexpr bool isDirty = true; + outBitStream.Write(isDirty); // Always serialize as dirty for now outBitStream.Write(m_Flags); outBitStream.Write(tamed ? m_Interaction.ability : ePetAbilityType::Invalid); // Something with the overhead icon? diff --git a/dGame/dComponents/PetComponent.h b/dGame/dComponents/PetComponent.h index 7244d5cb..a9f6b44c 100644 --- a/dGame/dComponents/PetComponent.h +++ b/dGame/dComponents/PetComponent.h @@ -13,11 +13,6 @@ #include "CDClientManager.h" #include -#include - -// Forward declarations -class PetTest; -class PetComponentFlagTest; /* * The current state of the pet AI @@ -364,16 +359,13 @@ public: void AddDrainImaginationTimer(Item* item, bool fromTaming = false); private: - // Needed so these can access flags - friend class DamagingPets; - friend class PetTest; - FRIEND_TEST(PetTest, PetComponentFlagTest); + // Needed so it can access flags + friend class DamagingPets; /** * Information for the minigame to be completed */ - struct PuzzleData - { + struct PuzzleData { /** * The LOT of the object that is to be created */ diff --git a/tests/dGameTests/dComponentsTests/PetComponentTests.cpp b/tests/dGameTests/dComponentsTests/PetComponentTests.cpp index 295b37d5..31633303 100644 --- a/tests/dGameTests/dComponentsTests/PetComponentTests.cpp +++ b/tests/dGameTests/dComponentsTests/PetComponentTests.cpp @@ -31,60 +31,6 @@ protected: } }; -/** - * Test bitset pet flags -*/ -TEST_F(PetTest, PetComponentFlagTest) { - using enum PetFlag; - - // Test setting and reading single flags, exclusively - petComponent->m_Flags.Reset(NONE); - ASSERT_TRUE(petComponent->m_Flags.HasOnly(NONE)); - petComponent->m_Flags.Reset(TAMEABLE); - ASSERT_TRUE(petComponent->m_Flags.HasOnly(TAMEABLE)); - ASSERT_FALSE(petComponent->m_Flags.HasOnly(SPAWNING)); - - // Test setting and reading multiple flags, exclusively - petComponent->m_Flags.Reset(NOT_WAITING, SPAWNING); - ASSERT_FALSE(petComponent->m_Flags.Has(TAMEABLE)); - ASSERT_TRUE(petComponent->m_Flags.Has(NOT_WAITING)); - ASSERT_TRUE(petComponent->m_Flags.Has(SPAWNING)); - ASSERT_TRUE(petComponent->m_Flags.Has(NOT_WAITING, SPAWNING)); - ASSERT_FALSE(petComponent->m_Flags.HasOnly(NOT_WAITING)); - ASSERT_FALSE(petComponent->m_Flags.HasOnly(SPAWNING)); - ASSERT_TRUE(petComponent->m_Flags.HasOnly(NOT_WAITING, SPAWNING)); - - // Test flags are being properly reset for next batch of tests - petComponent->m_Flags.Reset(NONE); - ASSERT_TRUE(petComponent->m_Flags.Has(NONE)); - ASSERT_TRUE(petComponent->m_Flags.HasOnly(NONE)); - ASSERT_FALSE(petComponent->m_Flags.Has(NOT_WAITING)); - ASSERT_FALSE(petComponent->m_Flags.Has(NOT_WAITING, SPAWNING, TAMEABLE)); - - // Test setting and reading single flags, non-exclusively - petComponent->m_Flags.Set(NOT_WAITING); - ASSERT_TRUE(petComponent->m_Flags.Has(NOT_WAITING)); - ASSERT_FALSE(petComponent->m_Flags.Has(SPAWNING)); - - // Test setting and reading multiple flags, non-exclusively - petComponent->m_Flags.Set(TAMEABLE, BEING_TAMED); - ASSERT_TRUE(petComponent->m_Flags.Has(TAMEABLE, BEING_TAMED)); - ASSERT_TRUE(petComponent->m_Flags.Has(NOT_WAITING)); - ASSERT_FALSE(petComponent->m_Flags.Has(NOT_WAITING, SPAWNING)); - ASSERT_TRUE(petComponent->m_Flags.Has(NOT_WAITING, TAMEABLE, BEING_TAMED)); - ASSERT_FALSE(petComponent->m_Flags.Has(SPAWNING)); - ASSERT_FALSE(petComponent->m_Flags.Has(SPAWNING, NOT_WAITING, TAMEABLE, BEING_TAMED)); - - // Test unsetting and reading multiple flags, non-exclusively - petComponent->m_Flags.Unset(NOT_WAITING, SPAWNING); - ASSERT_FALSE(petComponent->m_Flags.Has(NOT_WAITING, SPAWNING)); - ASSERT_FALSE(petComponent->m_Flags.Has(NOT_WAITING)); - ASSERT_TRUE(petComponent->m_Flags.Has(TAMEABLE, BEING_TAMED)); - ASSERT_FALSE(petComponent->m_Flags.Has(NOT_WAITING, TAMEABLE, BEING_TAMED)); - ASSERT_FALSE(petComponent->m_Flags.Has(SPAWNING)); - ASSERT_FALSE(petComponent->m_Flags.Has(SPAWNING, NOT_WAITING, TAMEABLE, BEING_TAMED)); -} - TEST_F(PetTest, PlacementNewAddComponentTest) { using enum PetFlag;