I'm writing testcases for my FastCode project.
I've written a generic tester like so:
TTest<T> = record
private
class var Def: System.Generics.Defaults.IComparer<T>;
class var F: FastDefaults.TComparison<T>;
strict private
class function Slow(const Left, Right: T): integer; static;
class function Fast(const Left, Right: T): integer; static;
class constructor Init;
public
class procedure Test(const Left, Right: T); static;
end;
A typical test case looks like:
[Test]
[TestCase('Single', '100.0,100.0')]
...many more testcases...
procedure TestSingle(const L,R: Single);
[Test]
[TestCase('Double', '100.0,100.0')]
...many more testcases... (identical to the one above).
procedure TestDouble(const L,R: double);
The testing code is typically as follows (repeated for every single type):
procedure TestDefault.TestSingle(const L, R: Single);
begin
TTest<Single>.Test(L,R);
end;
What I would like to do:
[Test]
[TestTypes('single,double,extended')]
[TestCase('description', '100.0,100.0')]
...many more test cases....
procedure Test<TC>(L,R: TC);
And have the test run for the types stated, so that I don't have to write so much boilerplate.
Can something like this be done in DUnitX?