TianoCore EDK2 master
Loading...
Searching...
No Matches
Base64UnitTest.c
Go to the documentation of this file.
1
9#include <Uefi.h>
10#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
14#include <Library/UnitTestLib.h>
15
16#define UNIT_TEST_APP_NAME "BaseLib Unit Test Application"
17#define UNIT_TEST_APP_VERSION "1.0"
18
33typedef struct {
34 CHAR8 *TestInput;
35 CHAR8 *TestOutput;
36 EFI_STATUS ExpectedStatus;
37 VOID *BufferToFree;
38 UINTN ExpectedSize;
40
41#define B64_TEST_1 ""
42#define BIN_TEST_1 ""
43
44#define B64_TEST_2 "Zg=="
45#define BIN_TEST_2 "f"
46
47#define B64_TEST_3 "Zm8="
48#define BIN_TEST_3 "fo"
49
50#define B64_TEST_4 "Zm9v"
51#define BIN_TEST_4 "foo"
52
53#define B64_TEST_5 "Zm9vYg=="
54#define BIN_TEST_5 "foob"
55
56#define B64_TEST_6 "Zm9vYmE="
57#define BIN_TEST_6 "fooba"
58
59#define B64_TEST_7 "Zm9vYmFy"
60#define BIN_TEST_7 "foobar"
61
62// Adds all white space - also ends the last quantum with only spaces afterwards
63#define B64_TEST_8_IN " \t\v Zm9\r\nvYmFy \f "
64#define BIN_TEST_8 "foobar"
65
66// Not a quantum multiple of 4
67#define B64_ERROR_1 "Zm9vymFy="
68
69// Invalid characters in the string
70#define B64_ERROR_2 "Zm$vymFy"
71
72// Too many '=' characters
73#define B64_ERROR_3 "Z==="
74
75// Poorly placed '='
76#define B64_ERROR_4 "Zm=vYmFy"
77
78#define MAX_TEST_STRING_SIZE (200)
79
80// ------------------------------------------------ Input----------Output-----------Result-------Free--Expected Output Size
81static BASIC_TEST_CONTEXT mBasicEncodeTest1 = { BIN_TEST_1, B64_TEST_1, EFI_SUCCESS, NULL, sizeof (B64_TEST_1) };
82static BASIC_TEST_CONTEXT mBasicEncodeTest2 = { BIN_TEST_2, B64_TEST_2, EFI_SUCCESS, NULL, sizeof (B64_TEST_2) };
83static BASIC_TEST_CONTEXT mBasicEncodeTest3 = { BIN_TEST_3, B64_TEST_3, EFI_SUCCESS, NULL, sizeof (B64_TEST_3) };
84static BASIC_TEST_CONTEXT mBasicEncodeTest4 = { BIN_TEST_4, B64_TEST_4, EFI_SUCCESS, NULL, sizeof (B64_TEST_4) };
85static BASIC_TEST_CONTEXT mBasicEncodeTest5 = { BIN_TEST_5, B64_TEST_5, EFI_SUCCESS, NULL, sizeof (B64_TEST_5) };
86static BASIC_TEST_CONTEXT mBasicEncodeTest6 = { BIN_TEST_6, B64_TEST_6, EFI_SUCCESS, NULL, sizeof (B64_TEST_6) };
87static BASIC_TEST_CONTEXT mBasicEncodeTest7 = { BIN_TEST_7, B64_TEST_7, EFI_SUCCESS, NULL, sizeof (B64_TEST_7) };
88static BASIC_TEST_CONTEXT mBasicEncodeError1 = { BIN_TEST_7, B64_TEST_1, EFI_BUFFER_TOO_SMALL, NULL, sizeof (B64_TEST_7) };
89
90static BASIC_TEST_CONTEXT mBasicDecodeTest1 = { B64_TEST_1, BIN_TEST_1, EFI_SUCCESS, NULL, sizeof (BIN_TEST_1)-1 };
91static BASIC_TEST_CONTEXT mBasicDecodeTest2 = { B64_TEST_2, BIN_TEST_2, EFI_SUCCESS, NULL, sizeof (BIN_TEST_2)-1 };
92static BASIC_TEST_CONTEXT mBasicDecodeTest3 = { B64_TEST_3, BIN_TEST_3, EFI_SUCCESS, NULL, sizeof (BIN_TEST_3)-1 };
93static BASIC_TEST_CONTEXT mBasicDecodeTest4 = { B64_TEST_4, BIN_TEST_4, EFI_SUCCESS, NULL, sizeof (BIN_TEST_4)-1 };
94static BASIC_TEST_CONTEXT mBasicDecodeTest5 = { B64_TEST_5, BIN_TEST_5, EFI_SUCCESS, NULL, sizeof (BIN_TEST_5)-1 };
95static BASIC_TEST_CONTEXT mBasicDecodeTest6 = { B64_TEST_6, BIN_TEST_6, EFI_SUCCESS, NULL, sizeof (BIN_TEST_6)-1 };
96static BASIC_TEST_CONTEXT mBasicDecodeTest7 = { B64_TEST_7, BIN_TEST_7, EFI_SUCCESS, NULL, sizeof (BIN_TEST_7)-1 };
97static BASIC_TEST_CONTEXT mBasicDecodeTest8 = { B64_TEST_8_IN, BIN_TEST_8, EFI_SUCCESS, NULL, sizeof (BIN_TEST_8)-1 };
98
99static BASIC_TEST_CONTEXT mBasicDecodeError1 = { B64_ERROR_1, B64_ERROR_1, EFI_INVALID_PARAMETER, NULL, 0 };
100static BASIC_TEST_CONTEXT mBasicDecodeError2 = { B64_ERROR_2, B64_ERROR_2, EFI_INVALID_PARAMETER, NULL, 0 };
101static BASIC_TEST_CONTEXT mBasicDecodeError3 = { B64_ERROR_3, B64_ERROR_3, EFI_INVALID_PARAMETER, NULL, 0 };
102static BASIC_TEST_CONTEXT mBasicDecodeError4 = { B64_ERROR_4, B64_ERROR_4, EFI_INVALID_PARAMETER, NULL, 0 };
103static BASIC_TEST_CONTEXT mBasicDecodeError5 = { B64_TEST_7, BIN_TEST_1, EFI_BUFFER_TOO_SMALL, NULL, sizeof (BIN_TEST_7)-1 };
104
109STATIC
110VOID
111EFIAPI
113 IN UNIT_TEST_CONTEXT Context
114 )
115{
117
118 Btc = (BASIC_TEST_CONTEXT *)Context;
119 if (Btc != NULL) {
120 // free string if set
121 if (Btc->BufferToFree != NULL) {
122 FreePool (Btc->BufferToFree);
123 Btc->BufferToFree = NULL;
124 }
125 }
126}
127
143STATIC
145EFIAPI
147 IN UNIT_TEST_CONTEXT Context
148 )
149{
151 CHAR8 *b64String;
152 CHAR8 *binString;
153 UINTN b64StringSize;
154 EFI_STATUS Status;
155 UINT8 *BinData;
156 UINTN BinSize;
157 CHAR8 *b64WorkString;
158 UINTN ReturnSize;
159 INTN CompareStatus;
160 UINTN indx;
161
162 Btc = (BASIC_TEST_CONTEXT *)Context;
163 binString = Btc->TestInput;
164 b64String = Btc->TestOutput;
165
166 //
167 // Only testing the the translate functionality, so preallocate the proper
168 // string buffer.
169 //
170
171 b64StringSize = AsciiStrnSizeS (b64String, MAX_TEST_STRING_SIZE);
172 BinSize = AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE);
173 BinData = (UINT8 *)binString;
174
175 b64WorkString = (CHAR8 *)AllocatePool (b64StringSize);
176 UT_ASSERT_NOT_NULL (b64WorkString);
177
178 Btc->BufferToFree = b64WorkString;
179 ReturnSize = b64StringSize;
180
181 Status = Base64Encode (BinData, BinSize, b64WorkString, &ReturnSize);
182
183 UT_ASSERT_STATUS_EQUAL (Status, Btc->ExpectedStatus);
184
185 UT_ASSERT_EQUAL (ReturnSize, Btc->ExpectedSize);
186
187 if (!EFI_ERROR (Btc->ExpectedStatus)) {
188 if (ReturnSize != 0) {
189 CompareStatus = AsciiStrnCmp (b64String, b64WorkString, ReturnSize);
190 if (CompareStatus != 0) {
191 UT_LOG_ERROR ("b64 string compare error - size=%d\n", ReturnSize);
192 for (indx = 0; indx < ReturnSize; indx++) {
193 UT_LOG_ERROR (" %2.2x", 0xff & b64String[indx]);
194 }
195
196 UT_LOG_ERROR ("\n b64 work string:\n");
197 for (indx = 0; indx < ReturnSize; indx++) {
198 UT_LOG_ERROR (" %2.2x", 0xff & b64WorkString[indx]);
199 }
200
201 UT_LOG_ERROR ("\n");
202 }
203
204 UT_ASSERT_EQUAL (CompareStatus, 0);
205 }
206 }
207
208 Btc->BufferToFree = NULL;
209 FreePool (b64WorkString);
210 return UNIT_TEST_PASSED;
211}
212
228STATIC
230EFIAPI
232 IN UNIT_TEST_CONTEXT Context
233 )
234{
236 CHAR8 *b64String;
237 CHAR8 *binString;
238 EFI_STATUS Status;
239 UINTN b64StringLen;
240 UINTN ReturnSize;
241 UINT8 *BinData;
242 UINTN BinSize;
243 INTN CompareStatus;
244 UINTN indx;
245
246 Btc = (BASIC_TEST_CONTEXT *)Context;
247 b64String = Btc->TestInput;
248 binString = Btc->TestOutput;
249
250 //
251 // Only testing the the translate functionality
252 //
253
254 b64StringLen = AsciiStrnLenS (b64String, MAX_TEST_STRING_SIZE);
255 BinSize = AsciiStrnLenS (binString, MAX_TEST_STRING_SIZE);
256
257 BinData = AllocatePool (BinSize);
258 UT_ASSERT_NOT_NULL (BinData);
259
260 Btc->BufferToFree = BinData;
261 ReturnSize = BinSize;
262
263 Status = Base64Decode (b64String, b64StringLen, BinData, &ReturnSize);
264
265 UT_ASSERT_STATUS_EQUAL (Status, Btc->ExpectedStatus);
266
267 // If an error is not expected, check the results
268 if (EFI_ERROR (Btc->ExpectedStatus)) {
269 if (Btc->ExpectedStatus == EFI_BUFFER_TOO_SMALL) {
270 UT_ASSERT_EQUAL (ReturnSize, Btc->ExpectedSize);
271 }
272 } else {
273 UT_ASSERT_EQUAL (ReturnSize, Btc->ExpectedSize);
274 if (ReturnSize != 0) {
275 CompareStatus = CompareMem (binString, BinData, ReturnSize);
276 if (CompareStatus != 0) {
277 UT_LOG_ERROR ("bin string compare error - size=%d\n", ReturnSize);
278 for (indx = 0; indx < ReturnSize; indx++) {
279 UT_LOG_ERROR (" %2.2x", 0xff & binString[indx]);
280 }
281
282 UT_LOG_ERROR ("\nBinData:\n");
283 for (indx = 0; indx < ReturnSize; indx++) {
284 UT_LOG_ERROR (" %2.2x", 0xff & BinData[indx]);
285 }
286
287 UT_LOG_ERROR ("\n");
288 }
289
290 UT_ASSERT_EQUAL (CompareStatus, 0);
291 }
292 }
293
294 Btc->BufferToFree = NULL;
295 FreePool (BinData);
296 return UNIT_TEST_PASSED;
297}
298
299#define SOURCE_STRING L"Hello"
300
301STATIC
303EFIAPI
304SafeStringContraintCheckTest (
305 IN UNIT_TEST_CONTEXT Context
306 )
307{
308 RETURN_STATUS Status;
309 CHAR16 Destination[20];
310 CHAR16 AllZero[20];
311
312 //
313 // Zero buffer used to verify Destination is not modified
314 //
315 ZeroMem (AllZero, sizeof (AllZero));
316
317 //
318 // Positive test case copy source unicode string to destination
319 //
320 ZeroMem (Destination, sizeof (Destination));
321 Status = StrCpyS (Destination, sizeof (Destination) / sizeof (CHAR16), SOURCE_STRING);
323 UT_ASSERT_MEM_EQUAL (Destination, SOURCE_STRING, sizeof (SOURCE_STRING));
324
325 //
326 // Positive test case with DestMax the same as Source size
327 //
328 ZeroMem (Destination, sizeof (Destination));
329 Status = StrCpyS (Destination, sizeof (SOURCE_STRING) / sizeof (CHAR16), SOURCE_STRING);
331 UT_ASSERT_MEM_EQUAL (Destination, SOURCE_STRING, sizeof (SOURCE_STRING));
332
333 //
334 // Negative test case with Destination NULL
335 //
336 ZeroMem (Destination, sizeof (Destination));
337 Status = StrCpyS (NULL, sizeof (Destination) / sizeof (CHAR16), SOURCE_STRING);
339 UT_ASSERT_MEM_EQUAL (Destination, AllZero, sizeof (AllZero));
340
341 //
342 // Negative test case with Source NULL
343 //
344 ZeroMem (Destination, sizeof (Destination));
345 Status = StrCpyS (Destination, sizeof (Destination) / sizeof (CHAR16), NULL);
347 UT_ASSERT_MEM_EQUAL (Destination, AllZero, sizeof (AllZero));
348
349 //
350 // Negative test case with DestMax too big
351 //
352 ZeroMem (Destination, sizeof (Destination));
353 Status = StrCpyS (Destination, MAX_UINTN, SOURCE_STRING);
355 UT_ASSERT_MEM_EQUAL (Destination, AllZero, sizeof (AllZero));
356
357 //
358 // Negative test case with DestMax 0
359 //
360 ZeroMem (Destination, sizeof (Destination));
361 Status = StrCpyS (Destination, 0, SOURCE_STRING);
363 UT_ASSERT_MEM_EQUAL (Destination, AllZero, sizeof (AllZero));
364
365 //
366 // Negative test case with DestMax smaller than Source size
367 //
368 ZeroMem (Destination, sizeof (Destination));
369 Status = StrCpyS (Destination, 1, SOURCE_STRING);
371 UT_ASSERT_MEM_EQUAL (Destination, AllZero, sizeof (AllZero));
372
373 //
374 // Negative test case with DestMax smaller than Source size by one character
375 //
376 ZeroMem (Destination, sizeof (Destination));
377 Status = StrCpyS (Destination, sizeof (SOURCE_STRING) / sizeof (CHAR16) - 1, SOURCE_STRING);
379 UT_ASSERT_MEM_EQUAL (Destination, AllZero, sizeof (AllZero));
380
381 //
382 // Negative test case with overlapping Destination and Source
383 //
384 ZeroMem (Destination, sizeof (Destination));
385 Status = StrCpyS (Destination, sizeof (Destination) / sizeof (CHAR16), Destination);
387 UT_ASSERT_MEM_EQUAL (Destination, AllZero, sizeof (AllZero));
388
389 return UNIT_TEST_PASSED;
390}
391
400STATIC
402EFIAPI
404 VOID
405 )
406{
407 EFI_STATUS Status;
408 UNIT_TEST_FRAMEWORK_HANDLE Fw;
409 UNIT_TEST_SUITE_HANDLE b64EncodeTests;
410 UNIT_TEST_SUITE_HANDLE b64DecodeTests;
411 UNIT_TEST_SUITE_HANDLE SafeStringTests;
412
413 Fw = NULL;
414
415 DEBUG ((DEBUG_INFO, "%a v%a\n", UNIT_TEST_APP_NAME, UNIT_TEST_APP_VERSION));
416
417 //
418 // Start setting up the test framework for running the tests.
419 //
420 Status = InitUnitTestFramework (&Fw, UNIT_TEST_APP_NAME, gEfiCallerBaseName, UNIT_TEST_APP_VERSION);
421 if (EFI_ERROR (Status)) {
422 DEBUG ((DEBUG_ERROR, "Failed in InitUnitTestFramework. Status = %r\n", Status));
423 goto EXIT;
424 }
425
426 //
427 // Populate the B64 Encode Unit Test Suite.
428 //
429 Status = CreateUnitTestSuite (&b64EncodeTests, Fw, "b64 Encode binary to Ascii string", "BaseLib.b64Encode", NULL, NULL);
430 if (EFI_ERROR (Status)) {
431 DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for b64EncodeTests\n"));
432 Status = EFI_OUT_OF_RESOURCES;
433 goto EXIT;
434 }
435
436 // --------------Suite-----------Description--------------Class Name----------Function--------Pre---Post-------------------Context-----------
437 AddTestCase (b64EncodeTests, "RFC 4686 Test Vector - Empty", "Test1", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeTest1);
438 AddTestCase (b64EncodeTests, "RFC 4686 Test Vector - f", "Test2", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeTest2);
439 AddTestCase (b64EncodeTests, "RFC 4686 Test Vector - fo", "Test3", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeTest3);
440 AddTestCase (b64EncodeTests, "RFC 4686 Test Vector - foo", "Test4", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeTest4);
441 AddTestCase (b64EncodeTests, "RFC 4686 Test Vector - foob", "Test5", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeTest5);
442 AddTestCase (b64EncodeTests, "RFC 4686 Test Vector - fooba", "Test6", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeTest6);
443 AddTestCase (b64EncodeTests, "RFC 4686 Test Vector - foobar", "Test7", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeTest7);
444 AddTestCase (b64EncodeTests, "Too small of output buffer", "Error1", RfcEncodeTest, NULL, CleanUpB64TestContext, &mBasicEncodeError1);
445 //
446 // Populate the B64 Decode Unit Test Suite.
447 //
448 Status = CreateUnitTestSuite (&b64DecodeTests, Fw, "b64 Decode Ascii string to binary", "BaseLib.b64Decode", NULL, NULL);
449 if (EFI_ERROR (Status)) {
450 DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for b64Decode Tests\n"));
451 Status = EFI_OUT_OF_RESOURCES;
452 goto EXIT;
453 }
454
455 AddTestCase (b64DecodeTests, "RFC 4686 Test Vector - Empty", "Test1", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest1);
456 AddTestCase (b64DecodeTests, "RFC 4686 Test Vector - f", "Test2", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest2);
457 AddTestCase (b64DecodeTests, "RFC 4686 Test Vector - fo", "Test3", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest3);
458 AddTestCase (b64DecodeTests, "RFC 4686 Test Vector - foo", "Test4", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest4);
459 AddTestCase (b64DecodeTests, "RFC 4686 Test Vector - foob", "Test5", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest5);
460 AddTestCase (b64DecodeTests, "RFC 4686 Test Vector - fooba", "Test6", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest6);
461 AddTestCase (b64DecodeTests, "RFC 4686 Test Vector - foobar", "Test7", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest7);
462 AddTestCase (b64DecodeTests, "Ignore Whitespace test", "Test8", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeTest8);
463
464 AddTestCase (b64DecodeTests, "Not a quantum multiple of 4", "Error1", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeError1);
465 AddTestCase (b64DecodeTests, "Invalid characters in the string", "Error2", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeError2);
466 AddTestCase (b64DecodeTests, "Too many padding characters", "Error3", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeError3);
467 AddTestCase (b64DecodeTests, "Incorrectly placed padding character", "Error4", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeError4);
468 AddTestCase (b64DecodeTests, "Too small of output buffer", "Error5", RfcDecodeTest, NULL, CleanUpB64TestContext, &mBasicDecodeError5);
469
470 //
471 // Populate the safe string Unit Test Suite.
472 //
473 Status = CreateUnitTestSuite (&SafeStringTests, Fw, "Safe String", "BaseLib.SafeString", NULL, NULL);
474 if (EFI_ERROR (Status)) {
475 DEBUG ((DEBUG_ERROR, "Failed in CreateUnitTestSuite for SafeStringTests\n"));
476 Status = EFI_OUT_OF_RESOURCES;
477 goto EXIT;
478 }
479
480 // --------------Suite-----------Description--------------Class Name----------Function--------Pre---Post-------------------Context-----------
481 AddTestCase (SafeStringTests, "SAFE_STRING_CONSTRAINT_CHECK", "SafeStringContraintCheckTest", SafeStringContraintCheckTest, NULL, NULL, NULL);
482
483 //
484 // Execute the tests.
485 //
486 Status = RunAllTestSuites (Fw);
487
488EXIT:
489 if (Fw) {
491 }
492
493 return Status;
494}
495
500EFIAPI
502 IN EFI_HANDLE ImageHandle,
503 IN EFI_SYSTEM_TABLE *SystemTable
504 )
505{
506 return UnitTestingEntry ();
507}
508
512int
514 int argc,
515 char *argv[]
516 )
517{
518 return UnitTestingEntry ();
519}
UINT64 UINTN
INT64 INTN
STATIC UNIT_TEST_STATUS EFIAPI RfcDecodeTest(IN UNIT_TEST_CONTEXT Context)
STATIC UNIT_TEST_STATUS EFIAPI RfcEncodeTest(IN UNIT_TEST_CONTEXT Context)
EFI_STATUS EFIAPI BaseLibUnitTestAppEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC VOID EFIAPI CleanUpB64TestContext(IN UNIT_TEST_CONTEXT Context)
STATIC EFI_STATUS EFIAPI UnitTestingEntry(VOID)
UINTN EFIAPI AsciiStrnLenS(IN CONST CHAR8 *String, IN UINTN MaxSize)
Definition: SafeString.c:1696
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
Definition: SafeString.c:226
INTN EFIAPI AsciiStrnCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString, IN UINTN Length)
Definition: String.c:872
RETURN_STATUS EFIAPI Base64Decode(IN CONST CHAR8 *Source OPTIONAL, IN UINTN SourceSize, OUT UINT8 *Destination OPTIONAL, IN OUT UINTN *DestinationSize)
Definition: String.c:1379
UINTN EFIAPI AsciiStrnSizeS(IN CONST CHAR8 *String, IN UINTN MaxSize)
Definition: SafeString.c:1749
RETURN_STATUS EFIAPI Base64Encode(IN CONST UINT8 *Source, IN UINTN SourceLength, OUT CHAR8 *Destination OPTIONAL, IN OUT UINTN *DestinationSize)
Definition: String.c:1195
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
int main()
=== TEST ENGINE ================================================================================
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define RETURN_BUFFER_TOO_SMALL
Definition: Base.h:1093
#define STATIC
Definition: Base.h:264
#define RETURN_ACCESS_DENIED
Definition: Base.h:1147
#define IN
Definition: Base.h:279
#define RETURN_INVALID_PARAMETER
Definition: Base.h:1076
#define DEBUG(Expression)
Definition: DebugLib.h:434
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_STATUS EFIAPI RunAllTestSuites(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
Definition: RunTests.c:145
#define UT_ASSERT_NOT_NULL(Pointer)
Definition: UnitTestLib.h:439
#define UT_LOG_ERROR(Format,...)
Definition: UnitTestLib.h:791
VOID * UNIT_TEST_CONTEXT
Definition: UnitTestLib.h:54
#define UT_ASSERT_MEM_EQUAL(BufferA, BufferB, Length)
Definition: UnitTestLib.h:389
#define UT_ASSERT_EQUAL(ValueA, ValueB)
Definition: UnitTestLib.h:375
#define UT_ASSERT_STATUS_EQUAL(Status, Expected)
Definition: UnitTestLib.h:427
EFI_STATUS EFIAPI CreateUnitTestSuite(OUT UNIT_TEST_SUITE_HANDLE *SuiteHandle, IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle, IN CHAR8 *Title, IN CHAR8 *Name, IN UNIT_TEST_SUITE_SETUP Setup OPTIONAL, IN UNIT_TEST_SUITE_TEARDOWN Teardown OPTIONAL)
Definition: UnitTestLib.c:326
EFI_STATUS EFIAPI FreeUnitTestFramework(IN UNIT_TEST_FRAMEWORK_HANDLE FrameworkHandle)
Definition: UnitTestLib.c:150
EFI_STATUS EFIAPI AddTestCase(IN UNIT_TEST_SUITE_HANDLE SuiteHandle, IN CHAR8 *Description, IN CHAR8 *Name, IN UNIT_TEST_FUNCTION Function, IN UNIT_TEST_PREREQUISITE Prerequisite OPTIONAL, IN UNIT_TEST_CLEANUP CleanUp OPTIONAL, IN UNIT_TEST_CONTEXT Context OPTIONAL)
Definition: UnitTestLib.c:426
EFI_STATUS EFIAPI InitUnitTestFramework(OUT UNIT_TEST_FRAMEWORK_HANDLE *FrameworkHandle, IN CHAR8 *Title, IN CHAR8 *ShortTitle, IN CHAR8 *VersionString)
Definition: UnitTestLib.c:204
UINT32 UNIT_TEST_STATUS
Definition: UnitTestLib.h:16
#define UT_ASSERT_NOT_EFI_ERROR(Status)
Definition: UnitTestLib.h:414