https://bugzilla.tianocore.org/show_bug.cgi?id=2505 * Add unit tests for SafeIntLib class * Add unit tests for BaseLib Base64 conversion APIs. * Add Test/MdePkgHostTest.dsc -to build host based unit tests * Update MdePkg.dsc to build target based tests for SafeIntLib and BaseLib * Update MdePkg.ci.yaml to build and run host based tests for SafeIntLib and BaseLib Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
		
			
				
	
	
		
			124 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			124 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /** @file
 | |
|   UEFI OS based application for unit testing the SafeIntLib.
 | |
| 
 | |
|   Copyright (c) Microsoft Corporation.<BR>
 | |
|   Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved.<BR>
 | |
|   SPDX-License-Identifier: BSD-2-Clause-Patent
 | |
| 
 | |
| **/
 | |
| 
 | |
| #ifndef _TEST_BASE_SAFE_INT_LIB_H_
 | |
| #define _TEST_BASE_SAFE_INT_LIB_H_
 | |
| 
 | |
| #include <PiPei.h>
 | |
| #include <Uefi.h>
 | |
| #include <Library/UefiLib.h>
 | |
| #include <Library/DebugLib.h>
 | |
| #include <Library/MemoryAllocationLib.h>
 | |
| #include <Library/UnitTestLib.h>
 | |
| #include <Library/SafeIntLib.h>
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeInt32ToUintn(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUint32ToIntn(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeIntnToInt32(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeIntnToUint32(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUintnToUint32(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUintnToIntn(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUintnToInt64(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeInt64ToIntn(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeInt64ToUintn(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUint64ToIntn(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUint64ToUintn(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUintnAdd(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeIntnAdd(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUintnSub(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeIntnSub(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeUintnMult(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| UNIT_TEST_STATUS
 | |
| EFIAPI
 | |
| TestSafeIntnMult(
 | |
|   IN UNIT_TEST_CONTEXT           Context
 | |
|   );
 | |
| 
 | |
| #endif
 |