Browse Source

* Patch from Ondrej to implement SameArray

Michaël Van Canneyt 2 years ago
parent
commit
68cdd7073f
1 changed files with 10 additions and 3 deletions
  1. 10 3
      tests/test/trtti24.pp

+ 10 - 3
tests/test/trtti24.pp

@@ -107,9 +107,16 @@ type
   TLargeSetP = set of TLargeEnum;
   TLargeSetP = set of TLargeEnum;
 {$pop}
 {$pop}
 
 
-function SameArray(const A, B: array of Byte): Boolean;
-begin
-  Result := True;
+function SameArray(const A, B: array of Byte): Boolean;                                                                             
+var                                                                                                                                 
+  I: Integer;                                                                                                                       
+begin                                                                                                                               
+  Result := Length(A)=Length(B);                                                                                                    
+  if not Result then                                                                                                                
+    Exit;                                                                                                                           
+  for I := Low(A) to High(A) do                                                                                                     
+    if A[I]<>B[I] then                                                                                                              
+      Exit(False);                                                                                                                  
 end;
 end;
 
 
 const
 const