unit tests with name and verbose report
jmh530
john.michael.hall at gmail.com
Fri Aug 5 13:05:43 UTC 2022
On Friday, 5 August 2022 at 12:16:25 UTC, Danesh Daroui wrote:
> [...]
>
> The unittest with version(unittest) didn't work for me and I
> got link error from the compiler since it didn't find the
> main() function.
>
If you don't have a main function, then you have to compile with
`--main`. I don't use `version(unittest)` unless I really really
have to.
> Frankly, I didn't like the way to use a macro (version(X) is a
> macro, right?) to use such a simple feature. I think such
> report to indicate which test is running and either succeeded
> or failed is an essential feature and I am surprised how it is
> not included in the compiler yet. To me, anonymous unittests
> are rather "show off" of a language! :)
>
It's conditional compilation, not a macro. The version(X)
approach also requires you to specify it somewhere that this
version is being called. I use the dub.sdl file, but you can do
it from the command line too.
> The "mir" is a good one but I was looking for machine reasoning
> algorithms which you can implement an expert system based on
> rules and facts in a knowledge base. It seems that it is not
> implemented. Thanks. :)
>
There are some tools that are built on `mir`, but it's not as
well developed as some other languages. Shigeki Karita [1] has
done some work here, like on `grain` or `tfd`. It's hard with
less man power. There are also tools to call functions from other
languages, like python or R. And you can also interface with C.
[1] https://github.com/ShigekiKarita
More information about the Digitalmars-d
mailing list