std.container: RedBlackTree questions
Ivan Kazmenko
gassa at mail.ru
Thu Aug 1 06:34:29 PDT 2013
On Thursday, 1 August 2013 at 12:55:30 UTC, John Colvin wrote:
> On Thursday, 1 August 2013 at 12:27:51 UTC, Ivan Kazmenko wrote:
>> On a relevant note, I find the unittests of RedBlackTree a bit
>> excessive even when they compile successfully. They seem to
>> test the integrity of the whole tree every time a tree
>> operation takes place, and that makes the unittests version of
>> my local code run too slowly. Is there a way to turn
>> unittests on only for user code and turn them off for the
>> standard library?
>>
>> Ivan Kazmenko.
>
> Unless you've compiled phobos with -unittest, the unittests in
> the standard library won't even exist in the binary, let alone
> take up time to run.
>
> Unless... I'm mistaken and actually for some bizarre reason
> unittests get dragged in from the import files, but that seems
> very unlikely.
There is a
> version(unittest) version = RBDoChecks;
line and the following
> version(RBDoChecks) check();
calls in the tree implementation.
Perhaps the approach is special to RedBlackTree.
I agree that RBDoChecks can be useful occasionally, for example,
when there is a bug in comparison function. But I would be happy
if the aforementioned line is removed from the library, or at
least a way to override it is provided.
More information about the Digitalmars-d-learn
mailing list