Add Strip color unit tests. Remove unused displayCol member from the Item class. 123/123 unit tests passing. Release Build 10607.

mac-build
sigonasr2 7 months ago
parent 23673ec2af
commit d208772107
  1. 21
      Adventures in Lestoria Tests/EngineTests.cpp
  2. 1
      Adventures in Lestoria/Item.h
  3. 2
      Adventures in Lestoria/Version.h
  4. BIN
      x64/Release/Adventures in Lestoria.exe

@ -51,6 +51,23 @@ namespace EngineTests
TEST_METHOD_INITIALIZE(PlayerInitialize){
testGame.reset(new AiL(true));
}
TEST_METHOD(StripColorTest){
std::string noColCode{"Hello World!"};
Assert::AreEqual("Hello World!"s,testGame->stripCol(noColCode),L"Function should not strip out any text when there's no color codes.");
std::string leadingColCode{"#FFFFFFHello World!"};
Assert::AreEqual("Hello World!"s,testGame->stripCol(leadingColCode),L"Function should strip out all color codes.");
std::string extraColCodes{"#FFFFFFHello #00FF00World!"};
Assert::AreEqual("Hello World!"s,testGame->stripCol(extraColCodes),L"Function should strip out all color codes.");
std::u32string u32noColCode{noColCode.begin(),noColCode.end()};
std::u32string u32noColCodeResult{testGame->stripCol(u32noColCode)};
Assert::AreEqual("Hello World!"s,std::string{u32noColCodeResult.begin(),u32noColCodeResult.end()},L"Function should not strip out any text when there's no color codes.");
std::u32string u32leadingColCode{noColCode.begin(),noColCode.end()};
std::u32string u32leadingColCodeResult{testGame->stripCol(u32leadingColCode)};
Assert::AreEqual("Hello World!"s,std::string{u32leadingColCodeResult.begin(),u32leadingColCodeResult.end()},L"Function should strip out all color codes.");
std::u32string u32extraColCodes{extraColCodes.begin(),extraColCodes.end()};
std::u32string u32extraColCodesResult{testGame->stripCol(u32extraColCodes)};
Assert::AreEqual("Hello World!"s,std::string{u32extraColCodesResult.begin(),u32extraColCodesResult.end()},L"Function should strip out all color codes.");
}
TEST_METHOD(StripLeadingColorTest){
std::string noColCode{"Hello World!"};
Assert::AreEqual("Hello World!"s,testGame->stripLeadingCol(noColCode),L"Function should not strip out any text when there's no color codes.");
@ -72,7 +89,7 @@ namespace EngineTests
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,"Hello World!").n,L"Should use source color as there's no HTML color code.");
Assert::AreEqual(BLUE.n,testGame->GetFinalRenderColor(WHITE,"#0000FFHello World!").n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(BLUE.n,testGame->GetFinalRenderColor(WHITE,"#0000FFHello #00FF00World!").n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,"Hello #00FF00World!").n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,"Hello #00FF00World!").n,L"Should use source color since there's no leading HTML color code.");
std::string testStr{"Hello World!"};
std::u32string u32testStr{testStr.begin(),testStr.end()};
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,testStr).n,L"Should use source color as there's no HTML color code.");
@ -84,7 +101,7 @@ namespace EngineTests
Assert::AreEqual(BLUE.n,testGame->GetFinalRenderColor(WHITE,extraColorCodeStr).n,L"Should use color in string since it has a leading HTML color code.");
std::string middleColorCodeStr{"Hello #00FF00World!"};
std::u32string u32middleColorCodeStr{middleColorCodeStr.begin(),middleColorCodeStr.end()};
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,middleColorCodeStr).n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,middleColorCodeStr).n,L"Should use source color since there's no leading HTML color code.");
}
};
}

@ -188,7 +188,6 @@ private:
Stats randomizedStats;
bool locked=false;
std::optional<ItemEnchant>enchant;
Pixel displayNameColor{WHITE};
void SetAmt(uint32_t newAmt);
static ItemEnhancementFunctionPrimingData enhanceFunctionPrimed;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 10604
#define VERSION_BUILD 10607
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save