mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-11-03 21:17:23 +01:00 
			
		
		
		
	https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
## @file
 | 
						|
# Routines for generating Pcd Database
 | 
						|
#
 | 
						|
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
 | 
						|
# SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
						|
 | 
						|
import unittest
 | 
						|
from Common.Misc import RemoveCComments
 | 
						|
from Workspace.BuildClassObject import ArrayIndex
 | 
						|
 | 
						|
class TestRe(unittest.TestCase):
 | 
						|
    def test_ccomments(self):
 | 
						|
        TestStr1 = """ {0x01,0x02} """
 | 
						|
        self.assertEquals(TestStr1, RemoveCComments(TestStr1))
 | 
						|
 | 
						|
        TestStr2 = """ L'TestString' """
 | 
						|
        self.assertEquals(TestStr2, RemoveCComments(TestStr2))
 | 
						|
 | 
						|
        TestStr3 = """ 'TestString' """
 | 
						|
        self.assertEquals(TestStr3, RemoveCComments(TestStr3))
 | 
						|
 | 
						|
        TestStr4 = """
 | 
						|
            {CODE({
 | 
						|
              {0x01, {0x02, 0x03, 0x04 }},// Data comment
 | 
						|
              {0x01, {0x02, 0x03, 0x04 }},// Data comment
 | 
						|
              })
 | 
						|
            }  /*
 | 
						|
               This is multiple line comments
 | 
						|
               The seconde line comment
 | 
						|
               */
 | 
						|
            // This is a comment
 | 
						|
        """
 | 
						|
        Expect_TestStr4 = """{CODE({
 | 
						|
              {0x01, {0x02, 0x03, 0x04 }},
 | 
						|
              {0x01, {0x02, 0x03, 0x04 }},
 | 
						|
              })
 | 
						|
            }"""
 | 
						|
        self.assertEquals(Expect_TestStr4, RemoveCComments(TestStr4).strip())
 | 
						|
 | 
						|
    def Test_ArrayIndex(self):
 | 
						|
        TestStr1 = """[1]"""
 | 
						|
        self.assertEquals(['[1]'], ArrayIndex.findall(TestStr1))
 | 
						|
 | 
						|
        TestStr2 = """[1][2][0x1][0x01][]"""
 | 
						|
        self.assertEquals(['[1]','[2]','[0x1]','[0x01]','[]'], ArrayIndex.findall(TestStr2))
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    unittest.main()
 |