diff --git a/DaedalicTestAutomationPlugin/Content/TestEquals/BP_TestEquals.uasset b/DaedalicTestAutomationPlugin/Content/TestEquals/BP_TestEquals.uasset index 4d7a5c8..2480fbd 100644 Binary files a/DaedalicTestAutomationPlugin/Content/TestEquals/BP_TestEquals.uasset and b/DaedalicTestAutomationPlugin/Content/TestEquals/BP_TestEquals.uasset differ diff --git a/DaedalicTestAutomationPlugin/Content/TestEquals/TestEquals.umap b/DaedalicTestAutomationPlugin/Content/TestEquals/TestEquals.umap index 588d400..b010136 100644 Binary files a/DaedalicTestAutomationPlugin/Content/TestEquals/TestEquals.umap and b/DaedalicTestAutomationPlugin/Content/TestEquals/TestEquals.umap differ diff --git a/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Private/DaeTestAssertBlueprintFunctionLibrary.cpp b/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Private/DaeTestAssertBlueprintFunctionLibrary.cpp index 2ee84cc..81d51e7 100644 --- a/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Private/DaeTestAssertBlueprintFunctionLibrary.cpp +++ b/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Private/DaeTestAssertBlueprintFunctionLibrary.cpp @@ -178,10 +178,13 @@ void UDaeTestAssertBlueprintFunctionLibrary::AssertNotEqualFloat(float Actual, f void UDaeTestAssertBlueprintFunctionLibrary::AssertEqualName(const FName& Actual, const FName& Expected, - const FString& What, + bool bIgnoreCase, const FString& What, UObject* Context /*= nullptr*/) { - if (!Actual.IsEqual(Expected)) + bool bEquals = bIgnoreCase ? Actual.IsEqual(Expected, ENameCase::IgnoreCase) + : Actual.IsEqual(Expected, ENameCase::CaseSensitive); + + if (!bEquals) { FString Message = FString::Format(*ErrorMessageFormatEqual, {What, Expected.ToString(), Actual.ToString()}); @@ -191,10 +194,14 @@ void UDaeTestAssertBlueprintFunctionLibrary::AssertEqualName(const FName& Actual void UDaeTestAssertBlueprintFunctionLibrary::AssertNotEqualName(const FName& Actual, const FName& Unexpected, + bool bIgnoreCase, const FString& What, UObject* Context /*= nullptr*/) { - if (Actual.IsEqual(Unexpected)) + bool bEquals = bIgnoreCase ? Actual.IsEqual(Unexpected, ENameCase::IgnoreCase) + : Actual.IsEqual(Unexpected, ENameCase::CaseSensitive); + + if (bEquals) { FString Message = FString::Format(*ErrorMessageFormatNotEqual, {What, Unexpected.ToString()}); @@ -204,10 +211,14 @@ void UDaeTestAssertBlueprintFunctionLibrary::AssertNotEqualName(const FName& Act void UDaeTestAssertBlueprintFunctionLibrary::AssertEqualString(const FString& Actual, const FString& Expected, + bool bIgnoreCase, const FString& What, UObject* Context /*= nullptr*/) { - if (!Actual.Equals(Expected)) + ESearchCase::Type SearchCase = bIgnoreCase ? ESearchCase::IgnoreCase + : ESearchCase::CaseSensitive; + + if (!Actual.Equals(Expected, SearchCase)) { FString Message = FString::Format(*ErrorMessageFormatEqual, {What, Expected, Actual}); OnTestFailed(Context, Message); @@ -216,10 +227,14 @@ void UDaeTestAssertBlueprintFunctionLibrary::AssertEqualString(const FString& Ac void UDaeTestAssertBlueprintFunctionLibrary::AssertNotEqualString(const FString& Actual, const FString& Unexpected, + bool bIgnoreCase, const FString& What, UObject* Context /*= nullptr*/) { - if (Actual.Equals(Unexpected)) + ESearchCase::Type SearchCase = bIgnoreCase ? ESearchCase::IgnoreCase + : ESearchCase::CaseSensitive; + + if (Actual.Equals(Unexpected, SearchCase)) { FString Message = FString::Format(*ErrorMessageFormatNotEqual, {What, Unexpected}); OnTestFailed(Context, Message); @@ -228,10 +243,12 @@ void UDaeTestAssertBlueprintFunctionLibrary::AssertNotEqualString(const FString& void UDaeTestAssertBlueprintFunctionLibrary::AssertEqualText(const FText& Actual, const FText& Expected, - const FString& What, + bool bIgnoreCase, const FString& What, UObject* Context /*= nullptr*/) { - if (!Actual.EqualTo(Expected)) + bool bEquals = bIgnoreCase ? Actual.EqualToCaseIgnored(Expected) : Actual.EqualTo(Expected); + + if (!bEquals) { FString Message = FString::Format(*ErrorMessageFormatEqual, {What, Expected.ToString(), Actual.ToString()}); @@ -241,10 +258,13 @@ void UDaeTestAssertBlueprintFunctionLibrary::AssertEqualText(const FText& Actual void UDaeTestAssertBlueprintFunctionLibrary::AssertNotEqualText(const FText& Actual, const FText& Unexpected, + bool bIgnoreCase, const FString& What, UObject* Context /*= nullptr*/) { - if (Actual.EqualTo(Unexpected)) + bool bEquals = bIgnoreCase ? Actual.EqualToCaseIgnored(Unexpected) : Actual.EqualTo(Unexpected); + + if (bEquals) { FString Message = FString::Format(*ErrorMessageFormatNotEqual, {What, Unexpected.ToString()}); diff --git a/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Public/DaeTestAssertBlueprintFunctionLibrary.h b/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Public/DaeTestAssertBlueprintFunctionLibrary.h index 2826066..666c3c8 100644 --- a/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Public/DaeTestAssertBlueprintFunctionLibrary.h +++ b/DaedalicTestAutomationPlugin/Source/DaedalicTestAutomationPlugin/Public/DaeTestAssertBlueprintFunctionLibrary.h @@ -99,37 +99,38 @@ class DAEDALICTESTAUTOMATIONPLUGIN_API UDaeTestAssertBlueprintFunctionLibrary /** Expects the specified names to be equal. */ UFUNCTION(BlueprintCallable, meta = (HidePin = "Context", DefaultToSelf = "Context", DisplayName = "Assert Equal (Name)")) - static void AssertEqualName(const FName& Actual, const FName& Expected, const FString& What, - UObject* Context = nullptr); + static void AssertEqualName(const FName& Actual, const FName& Expected, bool bIgnoreCase, + const FString& What, UObject* Context = nullptr); /** Expects the specified names not to be equal. */ UFUNCTION(BlueprintCallable, meta = (HidePin = "Context", DefaultToSelf = "Context", DisplayName = "Assert Not Equal (Name)")) - static void AssertNotEqualName(const FName& Actual, const FName& Unexpected, + static void AssertNotEqualName(const FName& Actual, const FName& Unexpected, bool bIgnoreCase, const FString& What, UObject* Context = nullptr); /** Expects the specified strings to be equal. */ UFUNCTION(BlueprintCallable, meta = (HidePin = "Context", DefaultToSelf = "Context", DisplayName = "Assert Equal (String)")) - static void AssertEqualString(const FString& Actual, const FString& Expected, + static void AssertEqualString(const FString& Actual, const FString& Expected, bool bIgnoreCase, const FString& What, UObject* Context = nullptr); /** Expects the specified strings not to be equal. */ UFUNCTION(BlueprintCallable, meta = (HidePin = "Context", DefaultToSelf = "Context", DisplayName = "Assert Not Equal (String)")) static void AssertNotEqualString(const FString& Actual, const FString& Unexpected, - const FString& What, UObject* Context = nullptr); + bool bIgnoreCase, const FString& What, + UObject* Context = nullptr); /** Expects the specified texts to be equal. */ UFUNCTION(BlueprintCallable, meta = (HidePin = "Context", DefaultToSelf = "Context", DisplayName = "Assert Equal (Text)")) - static void AssertEqualText(const FText& Actual, const FText& Expected, const FString& What, - UObject* Context = nullptr); + static void AssertEqualText(const FText& Actual, const FText& Expected, bool bIgnoreCase, + const FString& What, UObject* Context = nullptr); /** Expects the specified texts not to be equal. */ UFUNCTION(BlueprintCallable, meta = (HidePin = "Context", DefaultToSelf = "Context", DisplayName = "Assert Not Equal (Text)")) - static void AssertNotEqualText(const FText& Actual, const FText& Unexpected, + static void AssertNotEqualText(const FText& Actual, const FText& Unexpected, bool bIgnoreCase, const FString& What, UObject* Context = nullptr); /** Expects the specified vectors to be (nearly) equal. */