Changeset 109 for Generics/TemplateGenerics/Demo/UMainForm.pas
- Timestamp:
- Jan 3, 2011, 7:22:47 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/TemplateGenerics/Demo/UMainForm.pas
r108 r109 24 24 ButtonIntegerList: TButton; 25 25 ButtonStringList: TButton; 26 LabelTestName: TLabel; 26 27 ListViewOutput: TListView; 27 28 procedure ButtonBenchmarkDictionaryClick(Sender: TObject); … … 61 62 begin 62 63 ListViewOutput.Clear; 63 WriteOutput('TListInteger test');64 LabelTestName.Caption := 'TListInteger test'; 64 65 List := TListInteger.Create; 65 66 with List do try … … 90 91 begin 91 92 ListViewOutput.Clear; 92 WriteOutput('TListInteger test');93 LabelTestName.Caption := 'TMatrixInteger test'; 93 94 Matrix := TMatrixInteger.Create; 94 95 with Matrix do try 95 WriteOutput('AddMatrix([10, 20, 30, 40])'); 96 //AddMatrix([10, 20, 30, 40]); 97 WriteOutput('Implode: ' + Implode(',', IntToStr)); 96 Count := CreateIndex(2, 2); 97 WriteOutput('Count := CreateIndex(2, 2)', '[' + Implode('; ', ', ', IntToStr) + ']'); 98 Fill(CreateIndex(0, 0), Count, 1); 99 WriteOutput('Fill(1)', '[' + Implode('; ', ', ', IntToStr) + ']'); 100 Count := CreateIndex(3, 3); 101 WriteOutput('Count := CreateIndex(3, 3)', '[' + Implode('; ', ', ', IntToStr) + ']'); 102 WriteOutput('Count [Y, X]', IntToStr(Count.Y) + ', ' + IntToStr(Count.X)); 98 103 Clear; 99 for I := 0 to 10 do Add(I); 100 WriteOutput('Implode: ' + Implode(',', IntToStr)); 101 WriteOutput('Count: Y: ' + IntToStr(Count.Y) + ', ' + IntToStr(Count.X)); 102 WriteOutput('Implode: ' + Implode(',', IntToStr)); 103 WriteOutput('Reverse'); 104 Reverse; 105 WriteOutput('Implode: ' + Implode(',', IntToStr)); 106 WriteOutput('First: ' + IntToStr(First)); 107 WriteOutput('Last: ' + IntToStr(Last)); 108 //MoveItems(3, 2, 3); 109 WriteOutput('Implode: ' + Implode(',', IntToStr)); 110 WriteOutput('Insert(5, 11)'); 111 //Insert(5, 11); 112 WriteOutput('Implode: ' + Implode(',', IntToStr)); 104 WriteOutput('Clear', '[' + Implode('; ', ', ', IntToStr) + ']'); 105 WriteOutput('Count [Y, X]', IntToStr(Count.Y) + ', ' + IntToStr(Count.X)); 113 106 finally 114 107 Free; … … 127 120 begin 128 121 ListViewOutput.Clear; 129 WriteOutput('TListObject test');122 LabelTestName.Caption := 'TListObject test'; 130 123 List := TListObject.Create; 131 124 with List do try … … 152 145 begin 153 146 ListViewOutput.Clear; 154 WriteOutput('TQueueInteger test');147 LabelTestName.Caption := 'TQueueInteger test'; 155 148 Queue := TQueueInteger.Create; 156 149 with Queue do try … … 178 171 begin 179 172 ListViewOutput.Clear; 180 WriteOutput('TDictionaryString test');173 LabelTestName.Caption := 'TDictionaryString test'; 181 174 Dictionary := TDictionaryStringString.Create; 182 175 with Dictionary do try … … 204 197 var 205 198 List: TListChar; 206 begin 207 ListViewOutput.Clear; 208 WriteOutput('TListChar test'); 199 List2: TListChar; 200 begin 201 ListViewOutput.Clear; 202 LabelTestName.Caption := 'TListChar test'; 209 203 List := TListChar.Create; 204 List2 := TListChar.Create; 210 205 with List do try 211 206 AddArray([' ', ' ', 'A', 'b', 'c', 'd', ' ']); … … 222 217 LowerCase; 223 218 WriteOutput('LowerCase', '''' + Implode('', CharToStr) + ''''); 224 finally 219 WriteOutput('IndexOf(''c'')', IntToStr(IndexOf('c'))); 220 List2.AddArray(['c', 'b']); 221 WriteOutput('IndexOfList(''cb'')', IntToStr(IndexOfList(List2))); 222 finally 223 List2.Free; 225 224 Free; 226 225 end; … … 234 233 I: Integer; 235 234 begin 235 LabelTestName.Caption := 'Generic specialized TListObject vs. classic non-generic TList benchmark'; 236 236 ListViewOutput.Clear; 237 237 try … … 377 377 R: string; 378 378 begin 379 LabelTestName.Caption := 'Generic specialized TDictionaryStringString vs. classic non-generic TStringList benchmark'; 379 380 ListViewOutput.Clear; 380 381 try
Note:
See TracChangeset
for help on using the changeset viewer.