On Wed, Jun 28, 2023 at 03:57:47PM +0200, Grégory Vanuxem wrote:
> Hello,
>
> I'm wondering why there is only String parameters based routines in
> Unittest. What I mean is that from what I have seen the argument(s) to all
> routines are of type String:
> ==================================
> testLibraryError : String -> Void
> testTrue : String -> Void
> xftestTrue : String -> Void
...
> ===================================
>
> I can understand that, for example Expression(Integer), it is usually the
> simplest way to check correctness but I am wondering why there is only this
> method.
There is one basic reason. Assume we just pass arguments in "normal"
way to counting routines. If there is an error in an argument to
counting routine then execution is aborted _before_ call to counting
routine. So, to get consistent counts arguments to counting routines
must be "foolproof", that is should never cause errors. The way
we use is to pass strings, whatever its content string is a valid
argument and can not cause errors. If _execution_ of string causes
error, then counting routine will notice this and count test as
failed.
In principle some (maybe many) tests have arguments that should
never cause errors, so it would be possible to use non-string
form for them. But it is simpler and more reliable to always
use string form.
> I explain. I'm continuing to implement a "simple" wrapper to parts of
> Julia. And since all computations are done inside Julia and since this is
> essentially Float64 based I'm wondering if for my purpose I could provide
> my routines which are Julia based and returns Boolean values.
>
> In other words, what I would like is to add to the Unittest framework, at
> least, a simple routine say "isTrue" for example but handled by another
> module or even coded in the input file. I insist on using the actual
> framework with use of UnittestAux and UnittestCount routines I guess.
Well
isTrue(passes_test())
would treat error in 'passes_test()' the same as if 'passes_test()'
was not called at all. OTOH
testTrue("passes_test()")
will notice and report error in execution of 'passes_test()'.
--
Waldek Hebisch