public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "VivianNK" <vnowkakeane@linux.microsoft.com>
To: devel@edk2.groups.io
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Michael Kubacki <michael.kubacki@microsoft.com>
Subject: [edk2-devel] [PATCH v2 6/7] UnitTestFrameworkPkg: Apply uncrustify formatting to relevant files
Date: Wed, 16 Aug 2023 14:15:21 -0700	[thread overview]
Message-ID: <20230816211523.12-7-vnowkakeane@linux.microsoft.com> (raw)
In-Reply-To: <20230816211523.12-1-vnowkakeane@linux.microsoft.com>

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>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h                              |  2 +-
 UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogleTest.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/SampleGoogleTest.cpp b/UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogleTest.cpp
index c83e58596a82..94cbf2cf0b3c 100644
--- a/UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogleTest.cpp
+++ b/UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogleTest.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 (#107815): https://edk2.groups.io/g/devel/message/107815
Mute This Topic: https://groups.io/mt/100788671/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-08-16 21:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 21:15 [edk2-devel] [PATCH v2 0/7] Uncrustify GoogleTest update VivianNK
2023-08-16 21:15 ` [edk2-devel] [PATCH v2 1/7] .pytool: Set uncrustify check to audit only (temporary) VivianNK
2023-08-16 22:09   ` Michael Kubacki
2023-08-16 21:15 ` [edk2-devel] [PATCH v2 2/7] .pytool: Add cpp support to uncrustify plugin VivianNK
2023-08-16 21:15 ` [edk2-devel] [PATCH v2 3/7] MdeModulePkg: Apply uncrustify formatting to relevant files VivianNK
2023-08-16 21:15 ` [edk2-devel] [PATCH v2 4/7] MdePkg: " VivianNK
2023-08-16 21:15 ` [edk2-devel] [PATCH v2 5/7] SecurityPkg: " VivianNK
2023-08-17  2:41   ` Yao, Jiewen
2023-08-16 21:15 ` VivianNK [this message]
2023-08-16 21:15 ` [edk2-devel] [PATCH v2 7/7] .pytool: Undo uncrustify check change VivianNK
2023-08-16 22:09   ` Michael Kubacki
2023-09-12  1:08 ` 回复: [edk2-devel] [PATCH v2 0/7] Uncrustify GoogleTest update gaoliming via groups.io
2023-09-12 14:42 ` Michael D Kinney
2023-09-27 19:43   ` VivianNK
2023-10-24 20:34     ` VivianNK
2023-10-25 17:11       ` Michael D Kinney
2023-10-25 18:08         ` Michael D Kinney
2023-10-26 21:08           ` VivianNK
2023-10-27  2:41             ` Michael D Kinney

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=20230816211523.12-7-vnowkakeane@linux.microsoft.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