From 30b8760fd6861baa1e64c1f86493718dcb4619c1 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 31 Jul 2024 04:48:35 -0500 Subject: [PATCH] Add unit test to verify non-accessory items cannot be disassembled. --- Adventures in Lestoria Tests/ItemTests.cpp | 14 ++++++++++++++ Adventures in Lestoria/Version.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Adventures in Lestoria Tests/ItemTests.cpp b/Adventures in Lestoria Tests/ItemTests.cpp index d641f399..a6f0ed5f 100644 --- a/Adventures in Lestoria Tests/ItemTests.cpp +++ b/Adventures in Lestoria Tests/ItemTests.cpp @@ -193,5 +193,19 @@ namespace ItemTests Assert::IsTrue(disassembleRingTest.expired(),L"Original reference to disassembled ring should now be invalid."); Assert::AreEqual(1U,Inventory::GetItemCount(ITEM_DATA["Ring of the Slime King"].FragmentName()),L"Disassembly has given us a Slime King Ring Fragment."); } + TEST_METHOD(DisassembleNonAccessoryTest){ + try{ + Inventory::Disassemble(Inventory::AddItem("Test Armor"s)); + Assert::Fail(L"Disassembling Test Armor succeeded! This should NOT be allowed!"); + }catch(std::runtime_error&e){} + try{ + Inventory::Disassemble(Inventory::AddItem("Green Slime Remains"s)); + Assert::Fail(L"Disassembling Green Slime Remains succeeded! This should NOT be allowed!"); + }catch(std::runtime_error&e){} + try{ + Inventory::Disassemble(Inventory::AddItem("Health Potion"s)); + Assert::Fail(L"Disassembling a Health Potion succeeded! This should NOT be allowed!"); + }catch(std::runtime_error&e){} + } }; } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index d250d42d..20f1195a 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 10476 +#define VERSION_BUILD 10477 #define stringify(a) stringify_(a) #define stringify_(a) #a