std.container: RedBlackTree questions
Ivan Kazmenko
gassa at mail.ru
Fri Aug 2 07:36:54 PDT 2013
On Thursday, 1 August 2013 at 13:34:31 UTC, Ivan Kazmenko wrote:
> 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.
I'm confused. I think none of RedBlackTree code is pre-compiled
since it has compile-time parameters. But when I comment the
> version(unittest) version = RBDoChecks;
line in Phobos and recompile my example 4, I still get the same
errors with "-unittest" compiler option. What's going on?
More information about the Digitalmars-d-learn
mailing list