TianoCore EDK2 master
|
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UnitTestLib.h>
Go to the source code of this file.
Data Structures | |
struct | BASIC_TEST_CONTEXT |
Macros | |
#define | UNIT_TEST_APP_NAME "BaseLib Unit Test Application" |
#define | UNIT_TEST_APP_VERSION "1.0" |
#define | B64_TEST_1 "" |
#define | BIN_TEST_1 "" |
#define | B64_TEST_2 "Zg==" |
#define | BIN_TEST_2 "f" |
#define | B64_TEST_3 "Zm8=" |
#define | BIN_TEST_3 "fo" |
#define | B64_TEST_4 "Zm9v" |
#define | BIN_TEST_4 "foo" |
#define | B64_TEST_5 "Zm9vYg==" |
#define | BIN_TEST_5 "foob" |
#define | B64_TEST_6 "Zm9vYmE=" |
#define | BIN_TEST_6 "fooba" |
#define | B64_TEST_7 "Zm9vYmFy" |
#define | BIN_TEST_7 "foobar" |
#define | B64_TEST_8_IN " \t\v Zm9\r\nvYmFy \f " |
#define | BIN_TEST_8 "foobar" |
#define | B64_ERROR_1 "Zm9vymFy=" |
#define | B64_ERROR_2 "Zm$vymFy" |
#define | B64_ERROR_3 "Z===" |
#define | B64_ERROR_4 "Zm=vYmFy" |
#define | MAX_TEST_STRING_SIZE (200) |
#define | SOURCE_STRING L"Hello" |
Functions | |
STATIC VOID EFIAPI | CleanUpB64TestContext (IN UNIT_TEST_CONTEXT Context) |
STATIC UNIT_TEST_STATUS EFIAPI | RfcEncodeTest (IN UNIT_TEST_CONTEXT Context) |
STATIC UNIT_TEST_STATUS EFIAPI | RfcDecodeTest (IN UNIT_TEST_CONTEXT Context) |
STATIC UNIT_TEST_STATUS EFIAPI | SafeStringContraintCheckTest (IN UNIT_TEST_CONTEXT Context) |
STATIC EFI_STATUS EFIAPI | UnitTestingEntry (VOID) |
EFI_STATUS EFIAPI | BaseLibUnitTestAppEntry (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
int | main (int argc, char *argv[]) |
Unit tests of Base64 conversion APIs in BaseLib.
Copyright (C) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file Base64UnitTest.c.
#define B64_ERROR_1 "Zm9vymFy=" |
Definition at line 67 of file Base64UnitTest.c.
#define B64_ERROR_2 "Zm$vymFy" |
Definition at line 70 of file Base64UnitTest.c.
#define B64_ERROR_3 "Z===" |
Definition at line 73 of file Base64UnitTest.c.
#define B64_ERROR_4 "Zm=vYmFy" |
Definition at line 76 of file Base64UnitTest.c.
#define B64_TEST_1 "" |
Definition at line 41 of file Base64UnitTest.c.
#define B64_TEST_2 "Zg==" |
Definition at line 44 of file Base64UnitTest.c.
#define B64_TEST_3 "Zm8=" |
Definition at line 47 of file Base64UnitTest.c.
#define B64_TEST_4 "Zm9v" |
Definition at line 50 of file Base64UnitTest.c.
#define B64_TEST_5 "Zm9vYg==" |
Definition at line 53 of file Base64UnitTest.c.
#define B64_TEST_6 "Zm9vYmE=" |
Definition at line 56 of file Base64UnitTest.c.
#define B64_TEST_7 "Zm9vYmFy" |
Definition at line 59 of file Base64UnitTest.c.
#define B64_TEST_8_IN " \t\v Zm9\r\nvYmFy \f " |
Definition at line 63 of file Base64UnitTest.c.
#define BIN_TEST_1 "" |
Definition at line 42 of file Base64UnitTest.c.
#define BIN_TEST_2 "f" |
Definition at line 45 of file Base64UnitTest.c.
#define BIN_TEST_3 "fo" |
Definition at line 48 of file Base64UnitTest.c.
#define BIN_TEST_4 "foo" |
Definition at line 51 of file Base64UnitTest.c.
#define BIN_TEST_5 "foob" |
Definition at line 54 of file Base64UnitTest.c.
#define BIN_TEST_6 "fooba" |
Definition at line 57 of file Base64UnitTest.c.
#define BIN_TEST_7 "foobar" |
Definition at line 60 of file Base64UnitTest.c.
#define BIN_TEST_8 "foobar" |
Definition at line 64 of file Base64UnitTest.c.
#define MAX_TEST_STRING_SIZE (200) |
Definition at line 78 of file Base64UnitTest.c.
#define SOURCE_STRING L"Hello" |
Definition at line 299 of file Base64UnitTest.c.
#define UNIT_TEST_APP_NAME "BaseLib Unit Test Application" |
Definition at line 16 of file Base64UnitTest.c.
#define UNIT_TEST_APP_VERSION "1.0" |
Definition at line 17 of file Base64UnitTest.c.
EFI_STATUS EFIAPI BaseLibUnitTestAppEntry | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Standard UEFI entry point for target based unit test execution from UEFI Shell.
Definition at line 501 of file Base64UnitTest.c.
STATIC VOID EFIAPI CleanUpB64TestContext | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Simple clean up method to make sure tests clean up even if interrupted and fail in the middle.
Definition at line 112 of file Base64UnitTest.c.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Standard POSIX C entry point for host based unit test execution.
Definition at line 513 of file Base64UnitTest.c.
STATIC UNIT_TEST_STATUS EFIAPI RfcDecodeTest | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for Base64 decode APIs of BaseLib.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 231 of file Base64UnitTest.c.
STATIC UNIT_TEST_STATUS EFIAPI RfcEncodeTest | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for Base64 encode APIs of BaseLib.
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 146 of file Base64UnitTest.c.
STATIC UNIT_TEST_STATUS EFIAPI SafeStringContraintCheckTest | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Definition at line 304 of file Base64UnitTest.c.
STATIC EFI_STATUS EFIAPI UnitTestingEntry | ( | VOID | ) |
Initialize the unit test framework, suite, and unit tests for the Base64 conversion APIs of BaseLib and run the unit tests.
EFI_SUCCESS | All test cases were dispatched. |
EFI_OUT_OF_RESOURCES | There are not enough resources available to initialize the unit tests. |
Definition at line 403 of file Base64UnitTest.c.