public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"vnowkakeane@linux.microsoft.com"
	<vnowkakeane@linux.microsoft.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 6/7] UnitTestFrameworkPkg: Apply uncrustify formatting to relevant files
Date: Thu, 10 Aug 2023 19:25:27 +0000	[thread overview]
Message-ID: <CO1PR11MB4929FA106DE2256F6757E7C6D213A@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230809213226.1387-7-vnowkakeane@linux.microsoft.com>

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of VivianNK
> Sent: Wednesday, August 9, 2023 2:32 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH v1 6/7] UnitTestFrameworkPkg: Apply
> uncrustify formatting to relevant files
> 
> Apply uncrustify formatting to GoogleTest cpp and header files.
> 
> CC: Michael D Kinney <michael.d.kinney@intel.com>
> CC: Michael Kubacki <mikuback@linux.microsoft.com>
> CC: Sean Brogan <sean.brogan@microsoft.com>
> Signed-off-by: Vivian Nowka-Keane <vnowkakeane@linux.microsoft.com>
> ---
>  UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h
> |  2 +-
> 
> UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogle
> Test.cpp | 76 ++++++++++++--------
>  2 files changed, 47 insertions(+), 31 deletions(-)
> 
> diff --git a/UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h
> b/UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h
> index c0a3d8e66011..c723b5c23050 100644
> --- a/UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h
> +++ b/UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h
> @@ -14,7 +14,7 @@
>  #include <cstring>
> 
> 
> 
>  extern "C" {
> 
> -#include <Uefi.h>
> 
> +  #include <Uefi.h>
> 
>  }
> 
> 
> 
> 
> /////////////////////////////////////////////////////////////////////////
> /////
> 
> diff --git
> a/UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoog
> leTest.cpp
> b/UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoog
> leTest.cpp
> index c83e58596a82..94cbf2cf0b3c 100644
> ---
> a/UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoog
> leTest.cpp
> +++
> b/UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoog
> leTest.cpp
> @@ -18,7 +18,7 @@ extern "C" {
>    Sample unit test that verifies the expected result of an unsigned
> integer
> 
>    addition operation.
> 
>  **/
> 
> -TEST(SimpleMathTests, OnePlusOneShouldEqualTwo) {
> 
> +TEST (SimpleMathTests, OnePlusOneShouldEqualTwo) {
> 
>    UINTN  A;
> 
>    UINTN  B;
> 
>    UINTN  C;
> 
> @@ -34,11 +34,11 @@ TEST(SimpleMathTests, OnePlusOneShouldEqualTwo) {
>    Sample unit test that verifies that a global BOOLEAN is updatable.
> 
>  **/
> 
>  class GlobalBooleanVarTests : public ::testing::Test {
> 
> -  public:
> 
> -    BOOLEAN  SampleGlobalTestBoolean  = FALSE;
> 
> +public:
> 
> +  BOOLEAN SampleGlobalTestBoolean = FALSE;
> 
>  };
> 
> 
> 
> -TEST_F(GlobalBooleanVarTests, GlobalBooleanShouldBeChangeable) {
> 
> +TEST_F (GlobalBooleanVarTests, GlobalBooleanShouldBeChangeable) {
> 
>    SampleGlobalTestBoolean = TRUE;
> 
>    ASSERT_TRUE (SampleGlobalTestBoolean);
> 
> 
> 
> @@ -51,37 +51,46 @@ TEST_F(GlobalBooleanVarTests,
> GlobalBooleanShouldBeChangeable) {
>    pointer is updatable.
> 
>  **/
> 
>  class GlobalVarTests : public ::testing::Test {
> 
> -  public:
> 
> -    VOID  *SampleGlobalTestPointer = NULL;
> 
> +public:
> 
> +  VOID *SampleGlobalTestPointer = NULL;
> 
> 
> 
> -  protected:
> 
> -  void SetUp() override {
> 
> +protected:
> 
> +  void
> 
> +  SetUp (
> 
> +    ) override
> 
> +  {
> 
>      ASSERT_EQ ((UINTN)SampleGlobalTestPointer, (UINTN)NULL);
> 
>    }
> 
> -  void TearDown() {
> 
> +
> 
> +  void
> 
> +  TearDown (
> 
> +    )
> 
> +  {
> 
>      SampleGlobalTestPointer = NULL;
> 
>    }
> 
>  };
> 
> 
> 
> -TEST_F(GlobalVarTests, GlobalPointerShouldBeChangeable) {
> 
> +TEST_F (GlobalVarTests, GlobalPointerShouldBeChangeable) {
> 
>    SampleGlobalTestPointer = (VOID *)-1;
> 
>    ASSERT_EQ ((UINTN)SampleGlobalTestPointer, (UINTN)((VOID *)-1));
> 
>  }
> 
> 
> 
> -
> 
>  /**
> 
>    Set PcdDebugPropertyMask for each MacroTestsAssertsEnabledDisabled
> test
> 
>  **/
> 
>  class MacroTestsAssertsEnabledDisabled : public
> testing::TestWithParam<UINT8> {
> 
> -  void SetUp() {
> 
> -    PatchPcdSet8 (PcdDebugPropertyMask, GetParam());
> 
> +  void
> 
> +  SetUp (
> 
> +    )
> 
> +  {
> 
> +    PatchPcdSet8 (PcdDebugPropertyMask, GetParam ());
> 
>    }
> 
>  };
> 
> 
> 
>  /**
> 
>    Sample unit test using the ASSERT_TRUE() macro.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertTrue) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertTrue) {
> 
>    UINT64  Result;
> 
> 
> 
>    //
> 
> @@ -99,7 +108,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertTrue) {
>  /**
> 
>    Sample unit test using the ASSERT_FALSE() macro.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertFalse) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertFalse) {
> 
>    UINT64  Result;
> 
> 
> 
>    //
> 
> @@ -117,7 +126,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertFalse) {
>  /**
> 
>    Sample unit test using the ASSERT_EQ() macro.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertEqual) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertEqual) {
> 
>    UINT64  Result;
> 
> 
> 
>    //
> 
> @@ -135,7 +144,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertEqual) {
>  /**
> 
>    Sample unit test using the ASSERT_STREQ() macro.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertMemEqual) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertMemEqual) {
> 
>    CHAR8  *String1;
> 
>    CHAR8  *String2;
> 
> 
> 
> @@ -150,7 +159,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertMemEqual) {
>  /**
> 
>    Sample unit test using the ASSERT_NE() macro.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertNotEqual) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertNotEqual) {
> 
>    UINT64  Result;
> 
> 
> 
>    //
> 
> @@ -169,7 +178,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertNotEqual) {
>    Sample unit test using the ASSERT_TRUE() and ASSERT(FALSE)
> 
>    and EFI_EFFOR() macros to check status
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertNotEfiError) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertNotEfiError) {
> 
>    //
> 
>    // This test passes because the status is not an EFI error.
> 
>    //
> 
> @@ -184,7 +193,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertNotEfiError) {
>  /**
> 
>    Sample unit test using the ASSERT_EQ() macro to compare EFI_STATUS
> values.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertStatusEqual) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertStatusEqual) {
> 
>    //
> 
>    // This test passes because the status value are always equal.
> 
>    //
> 
> @@ -194,7 +203,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertStatusEqual) {
>  /**
> 
>    Sample unit test using ASSERT_NE() macro to make sure a pointer is not
> NULL.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroAssertNotNull) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroAssertNotNull) {
> 
>    UINT64  Result;
> 
> 
> 
>    //
> 
> @@ -206,7 +215,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroAssertNotNull) {
>  /**
> 
>    Sample unit test using that should not generate any ASSERTs()
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroExpectNoAssertFailure) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroExpectNoAssertFailure) {
> 
>    //
> 
>    // This test passes because it never triggers an ASSERT().
> 
>    //
> 
> @@ -222,7 +231,7 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroExpectNoAssertFailure) {
>  /**
> 
>    Sample unit test using the ASSERT_DEATH() macro to test expected
> ASSERT()s.
> 
>  **/
> 
> -TEST_P(MacroTestsAssertsEnabledDisabled, MacroExpectAssertFailure) {
> 
> +TEST_P (MacroTestsAssertsEnabledDisabled, MacroExpectAssertFailure) {
> 
>    //
> 
>    // Skip tests that verify an ASSERT() is triggered if ASSERT()s are
> disabled.
> 
>    //
> 
> @@ -243,21 +252,28 @@ TEST_P(MacroTestsAssertsEnabledDisabled,
> MacroExpectAssertFailure) {
>    ASSERT_DEATH (DecimalToBcd8 (101), "");
> 
>  }
> 
> 
> 
> -INSTANTIATE_TEST_SUITE_P(ValidInput,
> 
> -                         MacroTestsAssertsEnabledDisabled,
> 
> -                         ::testing::Values(PcdGet8
> (PcdDebugPropertyMask) | BIT0, PcdGet8 (PcdDebugPropertyMask) &
> (~BIT0)));
> 
> +INSTANTIATE_TEST_SUITE_P (
> 
> +  ValidInput,
> 
> +  MacroTestsAssertsEnabledDisabled,
> 
> +  ::testing::Values (PcdGet8 (PcdDebugPropertyMask) | BIT0, PcdGet8
> (PcdDebugPropertyMask) & (~BIT0))
> 
> +  );
> 
> 
> 
>  /**
> 
>    Sample unit test using the SCOPED_TRACE() macro for trace messages.
> 
>  **/
> 
> -TEST(MacroTestsMessages, MacroTraceMessage) {
> 
> +TEST (MacroTestsMessages, MacroTraceMessage) {
> 
>    //
> 
>    // Example of logging.
> 
>    //
> 
>    SCOPED_TRACE ("SCOPED_TRACE message\n");
> 
>  }
> 
> 
> 
> -int main(int argc, char* argv[]) {
> 
> -  testing::InitGoogleTest(&argc, argv);
> 
> -  return RUN_ALL_TESTS();
> 
> +int
> 
> +main (
> 
> +  int   argc,
> 
> +  char  *argv[]
> 
> +  )
> 
> +{
> 
> +  testing::InitGoogleTest (&argc, argv);
> 
> +  return RUN_ALL_TESTS ();
> 
>  }
> 
> --
> 2.41.0.windows.3
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#107671):
> https://edk2.groups.io/g/devel/message/107671
> Mute This Topic: https://groups.io/mt/100655294/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107700): https://edk2.groups.io/g/devel/message/107700
Mute This Topic: https://groups.io/mt/100655294/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-08-10 19:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 21:32 [edk2-devel] [PATCH v1 0/7] Uncrustify GoogleTest update VivianNK
2023-08-09 21:32 ` [edk2-devel] [PATCH v1 1/7] .pytool: Set uncrustify check to audit only VivianNK
2023-08-15  1:06   ` Michael Kubacki
     [not found]   ` <177B69072E52D32F.12117@groups.io>
2023-08-15  1:22     ` Michael Kubacki
2023-08-09 21:32 ` [edk2-devel] [PATCH v1 2/7] .pytool: Add cpp support to uncrustify plugin VivianNK
2023-08-15  1:22   ` Michael Kubacki
2023-08-09 21:32 ` [edk2-devel] [PATCH v1 3/7] MdeModulePkg: Applyy uncrustify formatting to relevant files VivianNK
2023-08-09 21:32 ` [edk2-devel] [PATCH v1 4/7] MdePkg: Apply " VivianNK
2023-08-09 21:32 ` [edk2-devel] [PATCH v1 5/7] SecurityPkg: " VivianNK
2023-08-09 21:32 ` [edk2-devel] [PATCH v1 6/7] UnitTestFrameworkPkg: " VivianNK
2023-08-10 19:25   ` Michael D Kinney [this message]
2023-08-15  1:22   ` Michael Kubacki
2023-08-09 21:32 ` [edk2-devel] [PATCH v1 7/7] .pytool: Undo uncrustify check change VivianNK
2023-08-15  1:28   ` Michael Kubacki
2023-08-15  1:32 ` [edk2-devel] [PATCH v1 0/7] Uncrustify GoogleTest update Michael Kubacki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB4929FA106DE2256F6757E7C6D213A@CO1PR11MB4929.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox