public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-test][Patch] uefi-sct/SctPkg: Sync StrUpr() test change to IHV
@ 2019-10-09  8:11 xianhui liu
  2019-10-10  1:58 ` Eric Jin
       [not found] ` <15CC2680403B89EE.14450@groups.io>
  0 siblings, 2 replies; 3+ messages in thread
From: xianhui liu @ 2019-10-09  8:11 UTC (permalink / raw)
  To: devel; +Cc: Heinrich Schuchardt, Supreeth Venkatesh, Eric Jin, xianhui liu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1911
sync commit cce43fc3ae30d343964fe02f09242ec8604eb44b
on file EFI/Protocol/UnicodeCollation2/BlackBoxTest
/UnicodeCollation2BBTestFunction.c to IHV

Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Cc: Eric Jin <eric.jin@intel.com>

Signed-off-by: xianhui liu <xianhuix.liu@intel.com>
---
 .../BlackBoxTest/UnicodeCollation2BBTestFunction.c | 218 ++++++++++-----------
 1 file changed, 107 insertions(+), 111 deletions(-)

diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c
index 7282034d..239be45b 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/UnicodeCollation2/BlackBoxTest/UnicodeCollation2BBTestFunction.c
@@ -1,7 +1,7 @@
 /** @file
 
   Copyright 2006 - 2016 Unified EFI, Inc.<BR>
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -28,6 +28,43 @@ Abstract:
 #include "SctLib.h"
 #include "UnicodeCollation2BBTestMain.h"
 
+STATIC CONST STRICOLL_TEST_DATA_FIELD             mStriCollTestData[] ={
+ {
+   L"",
+   L"",
+   STRING_COMPARE_EQUAL
+ },
+ {
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5Ax61\x62\x7D\x7E",
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7Ax61\x62\x7D\x7E",
+   STRING_COMPARE_EQUAL
+ },
+ {
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7Ax61\x62\x7D\x7E",
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5Ax61\x62\x7D\x7E",
+   STRING_COMPARE_EQUAL
+ },
+ {
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7E",
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7D",
+   STRING_COMPARE_MORE
+ },
+ {
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7E",
+   L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7F",
+   STRING_COMPARE_LESS
+ },
+ {
+   L"\x01",
+   L"",
+   STRING_COMPARE_MORE
+ },
+ {
+   L"",
+   L"\x01\x02",
+   STRING_COMPARE_LESS
+ },
+};
 
 /**
  *  Entrypoint for EFI_UNICODE_COLLATOIN2_PROTOCOL.StriColl() Function Test.
@@ -59,45 +96,6 @@ BBTestStriCollFunctionAutoTest (
   //
   // Test Data
   //
-  STRICOLL_TEST_DATA_FIELD             TestData[] ={
-     {
-       L"",
-       L"",
-       STRING_COMPARE_EQUAL
-     },
-     {
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5Ax61\x62\x7D\x7E",
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7Ax61\x62\x7D\x7E",
-       STRING_COMPARE_EQUAL
-     },
-     {
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7Ax61\x62\x7D\x7E",
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5Ax61\x62\x7D\x7E",
-       STRING_COMPARE_EQUAL
-     },
-     {
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7E",
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7D",
-       STRING_COMPARE_MORE
-     },
-     {
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7E",
-       L"\x01\x02\x11\x12\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5A\x61\x62\x7D\x7F",
-       STRING_COMPARE_LESS
-     },
-     {
-       L"\x01",
-       L"",
-       STRING_COMPARE_MORE
-     },
-     {
-       L"",
-       L"\x01\x02",
-       STRING_COMPARE_LESS
-     },
-  };
-
-
 
   //
   // Get the Standard Library Interface
@@ -123,19 +121,19 @@ BBTestStriCollFunctionAutoTest (
   }
 
   UnicodeCollation = (EFI_UNICODE_COLLATION2_PROTOCOL *)ClientInterface;
-  for (Index = 0; Index < sizeof (TestData) / sizeof (STRICOLL_TEST_DATA_FIELD); Index++) {
+  for (Index = 0; Index < sizeof (mStriCollTestData) / sizeof (STRICOLL_TEST_DATA_FIELD); Index++) {
     //
     // For each test data, test the StriColl functionality.
     //
     Result = UnicodeCollation->StriColl (
                                  UnicodeCollation,
-                                 TestData[Index].S1,
-                                 TestData[Index].S2
+                                 mStriCollTestData[Index].S1,
+                                 mStriCollTestData[Index].S2
                                  );
 
-    if ((Result < 0) && (TestData[Index].Result < 0) ||
-            (Result == 0) && (TestData[Index].Result == 0) ||
-            (Result > 0) && (TestData[Index].Result > 0)) {
+    if (((Result < 0) && (mStriCollTestData[Index].Result < 0)) ||
+    ((Result == 0) && (mStriCollTestData[Index].Result == 0)) ||
+    ((Result > 0) && (mStriCollTestData[Index].Result > 0))) {
       AssertionType = EFI_TEST_ASSERTION_PASSED;
     } else {
       AssertionType = EFI_TEST_ASSERTION_FAILED;
@@ -149,8 +147,8 @@ BBTestStriCollFunctionAutoTest (
                    L"%a:%d: S1='%s', S2='%s', Result=%d",
                    __FILE__,
                    (UINTN)__LINE__,
-                   TestData[Index].S1,
-                   TestData[Index].S2,
+                   mStriCollTestData[Index].S1,
+                   mStriCollTestData[Index].S2,
                    Result
                    );
   };
@@ -159,6 +157,59 @@ BBTestStriCollFunctionAutoTest (
 }
 
 
+//
+// Test Data
+//
+STATIC CONST METAIMATCH_TEST_DATA_FIELD           mMetaiMatchTestData[] ={
+   {L"", L"\x30\x50zz\x40\x20", FALSE},
+   {L"\x30\x50*\x40\x20", L"", FALSE},
+   {L"", L"", TRUE},
+   {L"\x30\x50*\x40\x20", L"\x30\x50zz\x40\x20", TRUE},
+   {L"\x30\x50*\x40\x20", L"\x30\x50\x30\x20", FALSE},
+
+   {L"\x30\x50?\x40\x20", L"\x30\x50H\x40\x20", TRUE},
+   {L"\x30\x50?\x40\x20", L"\x30\x50\x40\x20", FALSE},
+
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
+   {L"\x30\x50[abcdZyxw!)(@#*]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
+   {L"\x30\x50[abcdZyxw!)(@#*]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50W\x40\x20", TRUE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50w\x40\x20", TRUE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50@\x40\x20", TRUE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50*\x40\x20", TRUE},
+   {L"\x30\x50[abcdzyxw!)(@#*?]\x40\x20", L"\x30\x50?\x40\x20", TRUE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50g\x40\x20", FALSE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50q\x40\x20", FALSE},
+   {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50W\x40\x20", TRUE},
+
+//
+// Index = 19
+//
+   {L"[a-z]", L"b", TRUE},
+   {L"[a-z]", L"B", TRUE},
+   {L"[bcd]", L"B", TRUE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50r\x40\x20", TRUE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50R\x40\x20", TRUE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50Y\x40\x20", TRUE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50s\x40\x20", TRUE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50k\x40\x20", FALSE},
+   {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50K\x40\x20", FALSE},
+
+
+//
+// Index = 30
+//
+
+   {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x20\x40\x20", TRUE},
+   {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x25\x40\x20", TRUE},
+   {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x22\x40\x20", TRUE},
+   {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x10\x40\x20", FALSE},
+
+};
+
 /**
  *  Entrypoint for EFI_UNICODE_COLLATOIN_PROTOCOL.MetaiMatch() Function Test.
  *  @param This a pointer of EFI_BB_TEST_PROTOCOL.
@@ -186,61 +237,6 @@ BBTestMetaiMatchFunctionAutoTest (
   BOOLEAN                              Result;
   EFI_TEST_ASSERTION                   AssertionType;
 
-  //
-  // Test Data
-  //
-  METAIMATCH_TEST_DATA_FIELD           TestData[] ={
-     {L"", L"\x30\x50zz\x40\x20", FALSE},
-     {L"\x30\x50*\x40\x20", L"", FALSE},
-     {L"", L"", TRUE},
-     {L"\x30\x50*\x40\x20", L"\x30\x50zz\x40\x20", TRUE},
-     {L"\x30\x50*\x40\x20", L"\x30\x50\x30\x20", FALSE},
-
-     {L"\x30\x50?\x40\x20", L"\x30\x50H\x40\x20", TRUE},
-     {L"\x30\x50?\x40\x20", L"\x30\x50\x40\x20", FALSE},
-
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
-     {L"\x30\x50[abcdZyxw!)(@#*]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
-     {L"\x30\x50[abcdZyxw!)(@#*]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50W\x40\x20", TRUE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50w\x40\x20", TRUE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50@\x40\x20", TRUE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50*\x40\x20", TRUE},
-     {L"\x30\x50[abcdzyxw!)(@#*?]\x40\x20", L"\x30\x50?\x40\x20", TRUE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50g\x40\x20", FALSE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50q\x40\x20", FALSE},
-     {L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50W\x40\x20", TRUE},
-
-//
-// Index = 19
-//
-     {L"[a-z]", L"b", TRUE},
-     {L"[a-z]", L"B", TRUE},
-     {L"[bcd]", L"B", TRUE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50r\x40\x20", TRUE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50R\x40\x20", TRUE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50Y\x40\x20", TRUE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50s\x40\x20", TRUE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50k\x40\x20", FALSE},
-     {L"\x30\x50[R-Z]\x40\x20", L"\x30\x50K\x40\x20", FALSE},
-
-
-//
-// Index = 30
-//
-
-     {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x20\x40\x20", TRUE},
-     {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x25\x40\x20", TRUE},
-     {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x22\x40\x20", TRUE},
-     {L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x10\x40\x20", FALSE},
-
-  };
-
-
-
   //
   // Get the Standard Library Interface
   //
@@ -265,17 +261,17 @@ BBTestMetaiMatchFunctionAutoTest (
   }
 
   UnicodeCollation = (EFI_UNICODE_COLLATION2_PROTOCOL *)ClientInterface;
-  for (Index = 0; Index < sizeof (TestData) / sizeof (METAIMATCH_TEST_DATA_FIELD); Index ++) {
+  for (Index = 0; Index < sizeof (mMetaiMatchTestData) / sizeof (METAIMATCH_TEST_DATA_FIELD); Index ++) {
     //
     // For each test data, test the MetaiMatch functionality.
     //
     Result = UnicodeCollation->MetaiMatch (
                                  UnicodeCollation,
-                                 TestData[Index].String,
-                                 TestData[Index].Pattern
+                                 mMetaiMatchTestData[Index].String,
+                                 mMetaiMatchTestData[Index].Pattern
                                  );
 
-    if (Result == TestData[Index].Result) {
+    if (Result == mMetaiMatchTestData[Index].Result) {
       AssertionType = EFI_TEST_ASSERTION_PASSED;
     } else {
       AssertionType = EFI_TEST_ASSERTION_FAILED;
@@ -290,10 +286,10 @@ BBTestMetaiMatchFunctionAutoTest (
                    __FILE__,
                    (UINTN)__LINE__,
                    Index,
-                   TestData[Index].String,
-                   TestData[Index].Pattern,
+                   mMetaiMatchTestData[Index].String,
+                   mMetaiMatchTestData[Index].Pattern,
                    Result,
-                   TestData[Index].Result
+                   mMetaiMatchTestData[Index].Result
                    );
   };
 
@@ -455,7 +451,7 @@ BBTestStrUprFunctionAutoTest (
   CHAR16                               *TestData[] ={
                                              L"\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5Ax61\x62\x7D\x7E",
                                              L"\x30\x50[abcdzyxw!)(@#*]\x40\x20\x30\x50\ab\x40\x20",
-                                             L"\x30\x50[A-D]\x40\x20\x30\x50f\x40\x20",
+                                             L"\x30\x50[A-D]\x40\x20\x30\x50\x40\x20",
                                              L""
                                         };
 
-- 
2.14.1.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-11  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-09  8:11 [edk2-test][Patch] uefi-sct/SctPkg: Sync StrUpr() test change to IHV xianhui liu
2019-10-10  1:58 ` Eric Jin
     [not found] ` <15CC2680403B89EE.14450@groups.io>
2019-10-11  1:51   ` [edk2-devel] " Eric Jin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox