Seems to me that VerificationTests are a bit verbose:
TestReport[{VerificationTest[StringFreeQ["apple", "lp"], True],
VerificationTest[StringFreeQ["apple", "a" ~~ __ ~~ "e"], False],
VerificationTest[StringFreeQ["apple", "ap"], False],
VerificationTest[StringFreeQ["apple", "x"], True],
VerificationTest[StringFreeQ["", "asd"], True]}]
This was the first obvious thing that I tried:
args := {{"apple", "lp"}, {"apple", "a" ~~ __ ~~ "e"}, {"apple", "ap"}, {"apple", "x"}, {"", "asd"}};
results := {True, False, (Pause[2]; False), True, True};
tr = TestReport[
VerificationTest @@@ Thread[{StringFreeQ @@@ args, results}],
TimeConstraint -> Quantity[1, "Seconds"]]
But this solution has many problems:
- Timing specs and information aren't enforced and preserved
- Evaluations may leak
What are some elegant ways to cut down the verbosity here without messing with evaluation mechanics of the arguments to VerificationTest?