Changeset 146 for trunk/UTest.pas
- Timestamp:
- Aug 30, 2022, 7:56:17 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTest.pas
r138 r146 4 4 5 5 uses 6 Classes, SysUtils, Generics.Collections, UVCard ;6 Classes, SysUtils, Generics.Collections, UVCard, UTestCase; 7 7 8 8 type 9 TTestResult = (trNone, trPassed, trFailed);10 11 { TTestCase }12 13 TTestCase = class14 public15 Name: string;16 Result: TTestResult;17 Log: string;18 procedure Run; virtual;19 procedure Evaluate(Passed: Boolean);20 procedure Pass;21 procedure Fail;22 end;23 24 TTestCaseClass = class of TTestCase;25 26 { TTestCases }27 28 TTestCases = class(TObjectList<TTestCase>)29 function AddNew(Name: string; TestClass: TTestCaseClass): TTestCase;30 end;31 9 32 10 TTestCaseActionKind = (akNone, akRemoveExactDuplicates); … … 51 29 end; 52 30 53 resourcestring54 SNone = 'None';55 SPassed = 'Passed';56 SFailed = 'Failed';57 58 const59 ResultText: array[TTestResult] of string = (SNone, SPassed, SFailed);60 61 procedure Translate;62 63 31 64 32 implementation … … 70 38 SExpected = 'Expected:'; 71 39 SOutput = 'Output:'; 72 73 procedure Translate;74 begin75 ResultText[trNone] := SNone;76 ResultText[trPassed] := SPassed;77 ResultText[trFailed] := SFailed;78 end;79 40 80 41 { TTestCaseCheckProperty } … … 138 99 end; 139 100 140 { TTestCase }141 142 procedure TTestCase.Run;143 begin144 end;145 146 procedure TTestCase.Evaluate(Passed: Boolean);147 begin148 if Passed then Result := trPassed149 else Result := trFailed;150 end;151 152 procedure TTestCase.Pass;153 begin154 Result := trPassed;155 end;156 157 procedure TTestCase.Fail;158 begin159 Result := trFailed;160 end;161 162 { TTestCases }163 164 function TTestCases.AddNew(Name: string; TestClass: TTestCaseClass): TTestCase;165 begin166 Result := TestClass.Create;167 Result.Name := Name;168 Add(Result);169 end;170 171 101 end. 172 102
Note:
See TracChangeset
for help on using the changeset viewer.