The idea is that you can use a "console" to output some results to testing code, then compare the output text content to an expected value.
Take a look for instance at the regression tests available with the great DWSScript Open Source project. You'll find out some .pas files and some related .txt files.
For instance abs.pas:
var vf = 1.5;
var vi = 2;
var i : Integer := Abs(-vi);
PrintLn(i);
PrintLn(Abs(vi));
var f : Float := Abs(-vf);
PrintLn(f);
PrintLn(Abs(vf));
And the corresponding abs.txt content:
2
2
1.5
1.5
AFAIK there is no already existing solution by now integrate in the Delphi world.
Writing the test in the comment will lack for IDE auto-completion, and somewhat break the object pascal design. It would be something easy with DWS, but require to call the command-line Delphi compiler. Honestly, I do not see what is wrong having your own set of units dedicated to tests. A small piece of code with a for..to
loop with fixed and random values will have a much better test coverage than a fixed set of parameters.