From 7368fa3492f862d81f04867a1b326fe25ddb31ba Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Thu, 2 Mar 2023 01:36:24 -0800 Subject: [PATCH 1/5] movingBranches --- tests/dGameTests/CMakeLists.txt | 1 + tests/dGameTests/MissionPrerequisiteTest.cpp | 75 ++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 tests/dGameTests/MissionPrerequisiteTest.cpp diff --git a/tests/dGameTests/CMakeLists.txt b/tests/dGameTests/CMakeLists.txt index b1fdaa070..8f446e650 100644 --- a/tests/dGameTests/CMakeLists.txt +++ b/tests/dGameTests/CMakeLists.txt @@ -1,5 +1,6 @@ set(DGAMETEST_SOURCES "GameDependencies.cpp" + "MissionPrerequisiteTest.cpp" ) add_subdirectory(dComponentsTests) diff --git a/tests/dGameTests/MissionPrerequisiteTest.cpp b/tests/dGameTests/MissionPrerequisiteTest.cpp new file mode 100644 index 000000000..75e5ed36f --- /dev/null +++ b/tests/dGameTests/MissionPrerequisiteTest.cpp @@ -0,0 +1,75 @@ +#include "GameDependencies.h" +#include + +#include "MissionPrerequisites.h" + +class MissionPrerequisiteTest : public GameDependenciesTest { +protected: + void SetUp() override { + SetUpDependencies(); + } + + void TearDown() override { + TearDownDependencies(); + } +}; + +/** + * Test that the structure of a single prerequisite mission is created correctly. + */ +TEST_F(MissionPrerequisiteTest, OneMissionPrerequisiteInitializeTest) { + auto* preReq = new PrerequisiteExpression("1964"); + ASSERT_EQ(preReq->Geta(), 1964); + delete preReq; +}; + +/** + * Test that the structure of a multi mission prerequisite is created correctly. + */ +TEST_F(MissionPrerequisiteTest, MultiMissionPrerequisiteInitializeTest) { + auto* preReq = new PrerequisiteExpression("1806,1868"); + ASSERT_EQ(preReq->Geta(), 1806); + ASSERT_EQ(preReq->Getb()->Geta(), 1868); + delete preReq; +}; + +/** + * Test that the structure of an or prerequisite for missions is created properly + */ +TEST_F(MissionPrerequisiteTest, OrMissionPrerequisiteInitializeTest) { + auto* preReq = new PrerequisiteExpression("2061|891"); + ASSERT_TRUE(preReq->Getm_or()); + ASSERT_EQ(preReq->Geta(), 2061); + ASSERT_EQ(preReq->Getb()->Geta(), 891); + delete preReq; +}; + +/** + * Test that the structure of an or prerequisite for multiple missions is created properly + */ +TEST_F(MissionPrerequisiteTest, MultiOrMissionPrerequisiteInitializeTest) { + auto* preReq = new PrerequisiteExpression("815|812|813|814"); + ASSERT_TRUE(preReq->Getm_or()); + ASSERT_EQ(preReq->Geta(), 815); + ASSERT_EQ(preReq->Getb()->Geta(), 812); + ASSERT_TRUE(preReq->Getb()->Getm_or()); + ASSERT_EQ(preReq->Getb()->Geta(), 812); + ASSERT_EQ(preReq->Getb()->Getb()->Geta(), 813); + ASSERT_TRUE(preReq->Getb()->Getb()->Getm_or()); + ASSERT_EQ(preReq->Getb()->Getb()->Geta(), 813); + ASSERT_EQ(preReq->Getb()->Getb()->Getb()->Geta(), 814); + ASSERT_FALSE(preReq->Getb()->Getb()->Getb()->Getm_or()); + ASSERT_EQ(preReq->Getb()->Getb()->Getb()->Geta(), 814); + ASSERT_EQ(preReq->Getb()->Getb()->Getb()->Getb(), nullptr); + delete preReq; +}; + +/** + * Test that the structure of a mission with an expected state is created properly + */ +TEST_F(MissionPrerequisiteTest, MissionStatePrerequisiteInitializeTest) { + auto* preReq = new PrerequisiteExpression("236:2"); + ASSERT_EQ(preReq->Geta(), 236); + ASSERT_EQ(preReq->Getsub(), 2); + delete preReq; +}; From ed9faeb001cf2fd37f9d6a1b470bc093072d450b Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sat, 4 Mar 2023 04:18:32 -0800 Subject: [PATCH 2/5] Add test for pre-requisites --- tests/dGameTests/MissionPrerequisiteTest.cpp | 65 ++++++++++++++------ 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/tests/dGameTests/MissionPrerequisiteTest.cpp b/tests/dGameTests/MissionPrerequisiteTest.cpp index 75e5ed36f..e2efb3c0a 100644 --- a/tests/dGameTests/MissionPrerequisiteTest.cpp +++ b/tests/dGameTests/MissionPrerequisiteTest.cpp @@ -2,6 +2,7 @@ #include #include "MissionPrerequisites.h" +#include "eMissionState.h" class MissionPrerequisiteTest : public GameDependenciesTest { protected: @@ -19,7 +20,7 @@ class MissionPrerequisiteTest : public GameDependenciesTest { */ TEST_F(MissionPrerequisiteTest, OneMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("1964"); - ASSERT_EQ(preReq->Geta(), 1964); + ASSERT_EQ(preReq->mission, 1964); delete preReq; }; @@ -28,8 +29,8 @@ TEST_F(MissionPrerequisiteTest, OneMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, MultiMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("1806,1868"); - ASSERT_EQ(preReq->Geta(), 1806); - ASSERT_EQ(preReq->Getb()->Geta(), 1868); + ASSERT_EQ(preReq->mission, 1806); + ASSERT_EQ(preReq->nextMission->mission, 1868); delete preReq; }; @@ -38,9 +39,9 @@ TEST_F(MissionPrerequisiteTest, MultiMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, OrMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("2061|891"); - ASSERT_TRUE(preReq->Getm_or()); - ASSERT_EQ(preReq->Geta(), 2061); - ASSERT_EQ(preReq->Getb()->Geta(), 891); + ASSERT_TRUE(preReq->m_Or); + ASSERT_EQ(preReq->mission, 2061); + ASSERT_EQ(preReq->nextMission->mission, 891); delete preReq; }; @@ -49,18 +50,15 @@ TEST_F(MissionPrerequisiteTest, OrMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, MultiOrMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("815|812|813|814"); - ASSERT_TRUE(preReq->Getm_or()); - ASSERT_EQ(preReq->Geta(), 815); - ASSERT_EQ(preReq->Getb()->Geta(), 812); - ASSERT_TRUE(preReq->Getb()->Getm_or()); - ASSERT_EQ(preReq->Getb()->Geta(), 812); - ASSERT_EQ(preReq->Getb()->Getb()->Geta(), 813); - ASSERT_TRUE(preReq->Getb()->Getb()->Getm_or()); - ASSERT_EQ(preReq->Getb()->Getb()->Geta(), 813); - ASSERT_EQ(preReq->Getb()->Getb()->Getb()->Geta(), 814); - ASSERT_FALSE(preReq->Getb()->Getb()->Getb()->Getm_or()); - ASSERT_EQ(preReq->Getb()->Getb()->Getb()->Geta(), 814); - ASSERT_EQ(preReq->Getb()->Getb()->Getb()->Getb(), nullptr); + ASSERT_TRUE(preReq->m_Or); + ASSERT_EQ(preReq->mission, 815); + ASSERT_EQ(preReq->nextMission->mission, 812); + ASSERT_TRUE(preReq->nextMission->m_Or); + ASSERT_EQ(preReq->nextMission->nextMission->mission, 813); + ASSERT_TRUE(preReq->nextMission->nextMission->m_Or); + ASSERT_EQ(preReq->nextMission->nextMission->nextMission->mission, 814); + ASSERT_FALSE(preReq->nextMission->nextMission->nextMission->m_Or); + ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission, nullptr); delete preReq; }; @@ -69,7 +67,34 @@ TEST_F(MissionPrerequisiteTest, MultiOrMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, MissionStatePrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("236:2"); - ASSERT_EQ(preReq->Geta(), 236); - ASSERT_EQ(preReq->Getsub(), 2); + ASSERT_EQ(preReq->mission, 236); + ASSERT_EQ(preReq->missionState, eMissionState::ACTIVE); + delete preReq; +}; + +/** + * Test that the structure of an or prerequisite for missions is created properly + */ +TEST_F(MissionPrerequisiteTest, AndMissionPrerequisiteInitializeTest) { + auto* preReq = new PrerequisiteExpression("(2061|100)&(891|1500)"); + ASSERT_EQ(preReq->mission, 0); + ASSERT_FALSE(preReq->m_Or); + + ASSERT_EQ(preReq->nextMission->mission, 2061); + ASSERT_TRUE(preReq->nextMission->m_Or); + + ASSERT_EQ(preReq->nextMission->nextMission->mission, 100); + ASSERT_FALSE(preReq->nextMission->nextMission->m_Or); + + ASSERT_EQ(preReq->nextMission->nextMission->nextMission->mission, 0); + ASSERT_FALSE(preReq->nextMission->nextMission->nextMission->m_Or); + + ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission->mission, 891); + ASSERT_TRUE(preReq->nextMission->nextMission->nextMission->nextMission->m_Or); + + ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission->nextMission->mission, 1500); + ASSERT_FALSE(preReq->nextMission->nextMission->nextMission->nextMission->nextMission->m_Or); + + ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission->nextMission->nextMission, nullptr); delete preReq; }; From 31a330445493d3c273062b39db30cc4690090e11 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sat, 4 Mar 2023 06:22:02 -0800 Subject: [PATCH 3/5] Add more tests --- dGame/dMission/Mission.cpp | 11 +- dGame/dMission/Mission.h | 1 + dGame/dMission/MissionPrerequisites.cpp | 4 +- dGame/dMission/MissionPrerequisites.h | 1 + tests/dGameTests/MissionPrerequisiteTest.cpp | 170 +++++++++++++++---- 5 files changed, 152 insertions(+), 35 deletions(-) diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index 0e1acdac0..262dabbf9 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -24,6 +24,15 @@ #include "eMissionTaskType.h" #include "eMissionLockState.h" +Mission::Mission() { + m_MissionComponent = nullptr; + m_Completions = 0; + m_Timestamp = 0; + m_Reward = 0; + m_UniqueMissionID = 0; + m_State = eMissionState::UNKNOWN; + info = nullptr; +} Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { m_MissionComponent = missionComponent; @@ -202,7 +211,7 @@ bool Mission::IsValidMission(const uint32_t missionId, CDMissions& info) { } Entity* Mission::GetAssociate() const { - return m_MissionComponent->GetParent(); + return m_MissionComponent != nullptr? m_MissionComponent->GetParent() : nullptr; } User* Mission::GetUser() const { diff --git a/dGame/dMission/Mission.h b/dGame/dMission/Mission.h index b04c3548d..0cbfe6dd8 100644 --- a/dGame/dMission/Mission.h +++ b/dGame/dMission/Mission.h @@ -24,6 +24,7 @@ class MissionComponent; class Mission final { public: + Mission(); Mission(MissionComponent* missionComponent, uint32_t missionId); ~Mission(); diff --git a/dGame/dMission/MissionPrerequisites.cpp b/dGame/dMission/MissionPrerequisites.cpp index 6b55151ce..f51d7c74c 100644 --- a/dGame/dMission/MissionPrerequisites.cpp +++ b/dGame/dMission/MissionPrerequisites.cpp @@ -105,9 +105,7 @@ bool PrerequisiteExpression::Execute(const std::unordered_mapsub != 0) { // Special case for one Wisp Lee repeatable mission. - a = mission->GetClientInfo().id == 1883 ? - mission->GetMissionState() == static_cast(this->sub) : - mission->GetMissionState() >= static_cast(this->sub); + a = mission->GetMissionState() == static_cast(this->sub); } else if (mission->IsComplete()) { a = true; } diff --git a/dGame/dMission/MissionPrerequisites.h b/dGame/dMission/MissionPrerequisites.h index 13b8e903a..0821c364c 100644 --- a/dGame/dMission/MissionPrerequisites.h +++ b/dGame/dMission/MissionPrerequisites.h @@ -10,6 +10,7 @@ */ class PrerequisiteExpression final { +public: bool m_or; uint32_t a; uint32_t sub; diff --git a/tests/dGameTests/MissionPrerequisiteTest.cpp b/tests/dGameTests/MissionPrerequisiteTest.cpp index e2efb3c0a..ecff46651 100644 --- a/tests/dGameTests/MissionPrerequisiteTest.cpp +++ b/tests/dGameTests/MissionPrerequisiteTest.cpp @@ -6,12 +6,16 @@ class MissionPrerequisiteTest : public GameDependenciesTest { protected: + std::unordered_map missionMap; void SetUp() override { SetUpDependencies(); } void TearDown() override { TearDownDependencies(); + for (auto mission : missionMap) { + if (mission.second) delete mission.second; + } } }; @@ -20,7 +24,12 @@ class MissionPrerequisiteTest : public GameDependenciesTest { */ TEST_F(MissionPrerequisiteTest, OneMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("1964"); - ASSERT_EQ(preReq->mission, 1964); + ASSERT_EQ(preReq->a, 1964); + missionMap[1964] = new Mission(); + missionMap[1] = new Mission(); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[1964]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); delete preReq; }; @@ -29,8 +38,20 @@ TEST_F(MissionPrerequisiteTest, OneMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, MultiMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("1806,1868"); - ASSERT_EQ(preReq->mission, 1806); - ASSERT_EQ(preReq->nextMission->mission, 1868); + missionMap[1806] = new Mission(); + missionMap[1868] = new Mission(); + ASSERT_EQ(preReq->a, 1806); + ASSERT_FALSE(preReq->m_or); + ASSERT_EQ(preReq->b->a, 1868); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[1806]->SetMissionState(eMissionState::COMPLETE); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[1806]->SetMissionState(eMissionState::ACTIVE); + missionMap[1868]->SetMissionState(eMissionState::COMPLETE); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[1806]->SetMissionState(eMissionState::COMPLETE); + missionMap[1868]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); delete preReq; }; @@ -39,9 +60,20 @@ TEST_F(MissionPrerequisiteTest, MultiMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, OrMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("2061|891"); - ASSERT_TRUE(preReq->m_Or); - ASSERT_EQ(preReq->mission, 2061); - ASSERT_EQ(preReq->nextMission->mission, 891); + missionMap[2061] = new Mission(); + missionMap[891] = new Mission(); + ASSERT_TRUE(preReq->m_or); + ASSERT_EQ(preReq->a, 2061); + ASSERT_EQ(preReq->b->a, 891); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::ACTIVE); + missionMap[891]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::COMPLETE); + missionMap[891]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); delete preReq; }; @@ -50,15 +82,50 @@ TEST_F(MissionPrerequisiteTest, OrMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, MultiOrMissionPrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("815|812|813|814"); - ASSERT_TRUE(preReq->m_Or); - ASSERT_EQ(preReq->mission, 815); - ASSERT_EQ(preReq->nextMission->mission, 812); - ASSERT_TRUE(preReq->nextMission->m_Or); - ASSERT_EQ(preReq->nextMission->nextMission->mission, 813); - ASSERT_TRUE(preReq->nextMission->nextMission->m_Or); - ASSERT_EQ(preReq->nextMission->nextMission->nextMission->mission, 814); - ASSERT_FALSE(preReq->nextMission->nextMission->nextMission->m_Or); - ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission, nullptr); + missionMap[815] = new Mission(); + missionMap[812] = new Mission(); + missionMap[813] = new Mission(); + missionMap[814] = new Mission(); + ASSERT_TRUE(preReq->m_or); + ASSERT_EQ(preReq->a, 815); + ASSERT_EQ(preReq->b->a, 812); + ASSERT_TRUE(preReq->b->m_or); + ASSERT_EQ(preReq->b->b->a, 813); + ASSERT_TRUE(preReq->b->b->m_or); + ASSERT_EQ(preReq->b->b->b->a, 814); + ASSERT_FALSE(preReq->b->b->b->m_or); + ASSERT_EQ(preReq->b->b->b->b, nullptr); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[815]->SetMissionState(eMissionState::COMPLETE); + missionMap[812]->SetMissionState(eMissionState::ACTIVE); + missionMap[813]->SetMissionState(eMissionState::ACTIVE); + missionMap[814]->SetMissionState(eMissionState::ACTIVE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[815]->SetMissionState(eMissionState::ACTIVE); + missionMap[812]->SetMissionState(eMissionState::COMPLETE); + missionMap[813]->SetMissionState(eMissionState::ACTIVE); + missionMap[814]->SetMissionState(eMissionState::ACTIVE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[815]->SetMissionState(eMissionState::ACTIVE); + missionMap[812]->SetMissionState(eMissionState::ACTIVE); + missionMap[813]->SetMissionState(eMissionState::COMPLETE); + missionMap[814]->SetMissionState(eMissionState::ACTIVE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[815]->SetMissionState(eMissionState::ACTIVE); + missionMap[812]->SetMissionState(eMissionState::ACTIVE); + missionMap[813]->SetMissionState(eMissionState::ACTIVE); + missionMap[814]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[815]->SetMissionState(eMissionState::ACTIVE); + missionMap[812]->SetMissionState(eMissionState::COMPLETE); + missionMap[813]->SetMissionState(eMissionState::ACTIVE); + missionMap[814]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[815]->SetMissionState(eMissionState::COMPLETE); + missionMap[812]->SetMissionState(eMissionState::ACTIVE); + missionMap[813]->SetMissionState(eMissionState::COMPLETE); + missionMap[814]->SetMissionState(eMissionState::ACTIVE); + ASSERT_TRUE(preReq->Execute(missionMap)); delete preReq; }; @@ -67,8 +134,14 @@ TEST_F(MissionPrerequisiteTest, MultiOrMissionPrerequisiteInitializeTest) { */ TEST_F(MissionPrerequisiteTest, MissionStatePrerequisiteInitializeTest) { auto* preReq = new PrerequisiteExpression("236:2"); - ASSERT_EQ(preReq->mission, 236); - ASSERT_EQ(preReq->missionState, eMissionState::ACTIVE); + missionMap[236] = new Mission(); + ASSERT_EQ(preReq->a, 236); + ASSERT_EQ(preReq->sub, 2); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[236]->SetMissionState(eMissionState::COMPLETE); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[236]->SetMissionState(eMissionState::ACTIVE); + ASSERT_TRUE(preReq->Execute(missionMap)); delete preReq; }; @@ -76,25 +149,60 @@ TEST_F(MissionPrerequisiteTest, MissionStatePrerequisiteInitializeTest) { * Test that the structure of an or prerequisite for missions is created properly */ TEST_F(MissionPrerequisiteTest, AndMissionPrerequisiteInitializeTest) { - auto* preReq = new PrerequisiteExpression("(2061|100)&(891|1500)"); - ASSERT_EQ(preReq->mission, 0); - ASSERT_FALSE(preReq->m_Or); + auto* preReq = new PrerequisiteExpression("(2061|1000)&(8091|1500)"); + missionMap[2061] = new Mission(); + missionMap[1000] = new Mission(); + missionMap[8091] = new Mission(); + missionMap[1500] = new Mission(); + ASSERT_EQ(preReq->a, 0); + ASSERT_FALSE(preReq->m_or); - ASSERT_EQ(preReq->nextMission->mission, 2061); - ASSERT_TRUE(preReq->nextMission->m_Or); + ASSERT_EQ(preReq->b->a, 2061); + ASSERT_TRUE(preReq->b->m_or); - ASSERT_EQ(preReq->nextMission->nextMission->mission, 100); - ASSERT_FALSE(preReq->nextMission->nextMission->m_Or); + ASSERT_EQ(preReq->b->b->a, 1000); + ASSERT_FALSE(preReq->b->b->m_or); - ASSERT_EQ(preReq->nextMission->nextMission->nextMission->mission, 0); - ASSERT_FALSE(preReq->nextMission->nextMission->nextMission->m_Or); + ASSERT_EQ(preReq->b->b->b->a, 0); + ASSERT_FALSE(preReq->b->b->b->m_or); - ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission->mission, 891); - ASSERT_TRUE(preReq->nextMission->nextMission->nextMission->nextMission->m_Or); + ASSERT_EQ(preReq->b->b->b->b->a, 8091); + ASSERT_TRUE(preReq->b->b->b->b->m_or); - ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission->nextMission->mission, 1500); - ASSERT_FALSE(preReq->nextMission->nextMission->nextMission->nextMission->nextMission->m_Or); + ASSERT_EQ(preReq->b->b->b->b->b->a, 1500); + ASSERT_FALSE(preReq->b->b->b->b->b->m_or); - ASSERT_EQ(preReq->nextMission->nextMission->nextMission->nextMission->nextMission->nextMission, nullptr); + ASSERT_EQ(preReq->b->b->b->b->b->b, nullptr); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::COMPLETE); + missionMap[1000]->SetMissionState(eMissionState::ACTIVE); + missionMap[8091]->SetMissionState(eMissionState::ACTIVE); + missionMap[1500]->SetMissionState(eMissionState::ACTIVE); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::ACTIVE); + missionMap[1000]->SetMissionState(eMissionState::COMPLETE); + missionMap[8091]->SetMissionState(eMissionState::ACTIVE); + missionMap[1500]->SetMissionState(eMissionState::ACTIVE); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::ACTIVE); + missionMap[1000]->SetMissionState(eMissionState::ACTIVE); + missionMap[8091]->SetMissionState(eMissionState::COMPLETE); + missionMap[1500]->SetMissionState(eMissionState::ACTIVE); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::ACTIVE); + missionMap[1000]->SetMissionState(eMissionState::ACTIVE); + missionMap[8091]->SetMissionState(eMissionState::ACTIVE); + missionMap[1500]->SetMissionState(eMissionState::COMPLETE); + ASSERT_FALSE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::COMPLETE); + missionMap[1000]->SetMissionState(eMissionState::ACTIVE); + missionMap[8091]->SetMissionState(eMissionState::COMPLETE); + missionMap[1500]->SetMissionState(eMissionState::ACTIVE); + ASSERT_TRUE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::COMPLETE); + missionMap[1000]->SetMissionState(eMissionState::COMPLETE); + missionMap[8091]->SetMissionState(eMissionState::COMPLETE); + missionMap[1500]->SetMissionState(eMissionState::COMPLETE); + ASSERT_TRUE(preReq->Execute(missionMap)); delete preReq; }; From f2182c6f59a4021551f573462d8d9ababcf507b6 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 4 Mar 2023 06:25:25 -0800 Subject: [PATCH 4/5] Update MissionPrerequisiteTest.cpp --- tests/dGameTests/MissionPrerequisiteTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dGameTests/MissionPrerequisiteTest.cpp b/tests/dGameTests/MissionPrerequisiteTest.cpp index ecff46651..e8a3077be 100644 --- a/tests/dGameTests/MissionPrerequisiteTest.cpp +++ b/tests/dGameTests/MissionPrerequisiteTest.cpp @@ -178,7 +178,7 @@ TEST_F(MissionPrerequisiteTest, AndMissionPrerequisiteInitializeTest) { missionMap[1000]->SetMissionState(eMissionState::ACTIVE); missionMap[8091]->SetMissionState(eMissionState::ACTIVE); missionMap[1500]->SetMissionState(eMissionState::ACTIVE); - ASSERT_FALSE(preReq->Execute(missionMap)); + ASSERT_FALSE(preReq->Execute(missionMap)); // BUG HERE!!! missionMap[2061]->SetMissionState(eMissionState::ACTIVE); missionMap[1000]->SetMissionState(eMissionState::COMPLETE); missionMap[8091]->SetMissionState(eMissionState::ACTIVE); From 15b1519b658198581110fbacf679f7973e312cf4 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Sat, 4 Mar 2023 22:04:18 -0800 Subject: [PATCH 5/5] Update MissionPrerequisiteTest.cpp --- tests/dGameTests/MissionPrerequisiteTest.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/dGameTests/MissionPrerequisiteTest.cpp b/tests/dGameTests/MissionPrerequisiteTest.cpp index e8a3077be..ec14ec10a 100644 --- a/tests/dGameTests/MissionPrerequisiteTest.cpp +++ b/tests/dGameTests/MissionPrerequisiteTest.cpp @@ -173,36 +173,41 @@ TEST_F(MissionPrerequisiteTest, AndMissionPrerequisiteInitializeTest) { ASSERT_FALSE(preReq->b->b->b->b->b->m_or); ASSERT_EQ(preReq->b->b->b->b->b->b, nullptr); - ASSERT_FALSE(preReq->Execute(missionMap)); + EXPECT_FALSE(preReq->Execute(missionMap)); missionMap[2061]->SetMissionState(eMissionState::COMPLETE); missionMap[1000]->SetMissionState(eMissionState::ACTIVE); missionMap[8091]->SetMissionState(eMissionState::ACTIVE); missionMap[1500]->SetMissionState(eMissionState::ACTIVE); - ASSERT_FALSE(preReq->Execute(missionMap)); // BUG HERE!!! + EXPECT_FALSE(preReq->Execute(missionMap)); missionMap[2061]->SetMissionState(eMissionState::ACTIVE); missionMap[1000]->SetMissionState(eMissionState::COMPLETE); missionMap[8091]->SetMissionState(eMissionState::ACTIVE); missionMap[1500]->SetMissionState(eMissionState::ACTIVE); - ASSERT_FALSE(preReq->Execute(missionMap)); + EXPECT_FALSE(preReq->Execute(missionMap)); missionMap[2061]->SetMissionState(eMissionState::ACTIVE); missionMap[1000]->SetMissionState(eMissionState::ACTIVE); missionMap[8091]->SetMissionState(eMissionState::COMPLETE); missionMap[1500]->SetMissionState(eMissionState::ACTIVE); - ASSERT_FALSE(preReq->Execute(missionMap)); + EXPECT_FALSE(preReq->Execute(missionMap)); missionMap[2061]->SetMissionState(eMissionState::ACTIVE); missionMap[1000]->SetMissionState(eMissionState::ACTIVE); missionMap[8091]->SetMissionState(eMissionState::ACTIVE); missionMap[1500]->SetMissionState(eMissionState::COMPLETE); - ASSERT_FALSE(preReq->Execute(missionMap)); + EXPECT_FALSE(preReq->Execute(missionMap)); missionMap[2061]->SetMissionState(eMissionState::COMPLETE); missionMap[1000]->SetMissionState(eMissionState::ACTIVE); missionMap[8091]->SetMissionState(eMissionState::COMPLETE); missionMap[1500]->SetMissionState(eMissionState::ACTIVE); - ASSERT_TRUE(preReq->Execute(missionMap)); + EXPECT_TRUE(preReq->Execute(missionMap)); + missionMap[2061]->SetMissionState(eMissionState::ACTIVE); + missionMap[1000]->SetMissionState(eMissionState::COMPLETE); + missionMap[8091]->SetMissionState(eMissionState::ACTIVE); + missionMap[1500]->SetMissionState(eMissionState::COMPLETE); + EXPECT_TRUE(preReq->Execute(missionMap)); missionMap[2061]->SetMissionState(eMissionState::COMPLETE); missionMap[1000]->SetMissionState(eMissionState::COMPLETE); missionMap[8091]->SetMissionState(eMissionState::COMPLETE); missionMap[1500]->SetMissionState(eMissionState::COMPLETE); - ASSERT_TRUE(preReq->Execute(missionMap)); + EXPECT_TRUE(preReq->Execute(missionMap)); delete preReq; };