version(unittest) in imported modules

Ivan Kazmenko gassa at mail.ru
Sun Mar 2 23:29:09 PST 2014


On Sunday, 2 March 2014 at 21:03:12 UTC, Dicebot wrote:
> On Sunday, 2 March 2014 at 19:37:47 UTC, Peter Alexander wrote:
>> Tests on imported modules are not always run otherwise 
>> everyone would be constantly running phobos tests. rdmd is 
>> special in that automatically compiles imports.
>
> Hm, I am surprised to find that you are right. That does not 
> make sense. static asserts from Phobos should trigger.

Somewhat off topic, but this makes me wonder, what is the 
intended way of resolving these issues?  (My guess is that they 
are what triggered the discussion anyway.)

https://d.puremagic.com/issues/show_bug.cgi?id=12245
(BinaryHeap exhibits quadratic performance in debug mode)

https://d.puremagic.com/issues/show_bug.cgi?id=12246
(RedBlackTree exhibits quadratic performance with -unittest 
command line option)

Basically, when dealing with containers, a programmer can wish 
for two mutually exclusive ways:

1. (normal operation) The containers show the advertised 
asymptotic.

2. (paranoia) The containers are checking their integrity after 
each operation.  This could help e.g. when then comparison 
function is flawed in some non-obvious way (is not transitive).

A "-debug=BinaryHeap" seems like a good way to give 2.  Perhaps 
the same can be done for RedBlackTree?  Such checks are not 
exactly unit tests, they vary from one application of a container 
to another.

Ivan Kazmenko.


More information about the Digitalmars-d mailing list