mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 12:49:42 +01:00 
			
		
		
		
	tests: added test for UTF8CharacterToUnicode
git-svn-id: trunk@18736 -
This commit is contained in:
		
							parent
							
								
									52fd879da6
								
							
						
					
					
						commit
						8b19dba49b
					
				@ -17,6 +17,7 @@ type
 | 
			
		||||
    procedure TestUTF16ToUTF8;
 | 
			
		||||
    procedure TestUTF16ToUnicode;
 | 
			
		||||
    procedure TestUnicodeToUTF16;
 | 
			
		||||
    procedure TestUTF8CharacterToUnicode;
 | 
			
		||||
  end; 
 | 
			
		||||
  
 | 
			
		||||
const
 | 
			
		||||
@ -125,6 +126,20 @@ begin
 | 
			
		||||
  AssertEquals(#$DBFF#$DFFD, UnicodeToUTF16($10FFFD));
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
procedure TTestUnicode.TestUTF8CharacterToUnicode;
 | 
			
		||||
var
 | 
			
		||||
  i,u: cardinal;
 | 
			
		||||
  s: String;
 | 
			
		||||
  dum: integer;
 | 
			
		||||
begin
 | 
			
		||||
  for i:=0 to $10FFFF do
 | 
			
		||||
  begin
 | 
			
		||||
    s:=UnicodeToUTF8(i);
 | 
			
		||||
    u:=UTF8CharacterToUnicode(PChar(s), dum);
 | 
			
		||||
    AssertEquals('got (hexidecimal): ' + InttoHex(u,6), i, u);
 | 
			
		||||
  end;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
initialization
 | 
			
		||||
 | 
			
		||||
  AddToLCLTestSuite(TTestUnicode);
 | 
			
		||||
 | 
			
		||||
@ -2,10 +2,11 @@
 | 
			
		||||
<CONFIG>
 | 
			
		||||
  <ProjectOptions>
 | 
			
		||||
    <PathDelim Value="\"/>
 | 
			
		||||
    <Version Value="6"/>
 | 
			
		||||
    <Version Value="7"/>
 | 
			
		||||
    <General>
 | 
			
		||||
      <Flags>
 | 
			
		||||
        <AlwaysBuild Value="False"/>
 | 
			
		||||
        <LRSInOutputDirectory Value="False"/>
 | 
			
		||||
      </Flags>
 | 
			
		||||
      <SessionStorage Value="InIDEConfig"/>
 | 
			
		||||
      <MainUnit Value="0"/>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user