Quit running foreign unittests >_<

Ivan Kazmenko via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 27 07:30:55 PDT 2015


On Monday, 27 April 2015 at 11:30:04 UTC, Steven Schveighoffer 
wrote:
> The problem is as follows:
>
> 1. Unit tests for some library are written for that library. 
> They are written to run tests during unit tests of that library 
> only (possibly with certain requirements of environment, 
> including build lines, or expectations of system resource 
> availability).

By the way, a unittest-related issue still stands in DMD 2.067.1 
for RedBlackTree:
https://issues.dlang.org/show_bug.cgi?id=12246

A similar matter got resolved quickly for BinaryHeap:
https://issues.dlang.org/show_bug.cgi?id=12245

BinaryHeap's case was handled by putting the container's 
unittests into "debug(BinaryHeap)".

RedBlackTree's case is controlled via "debug(RBDoChecks)" 
(formerly "version(RBDoChecks)").  The difference is the presence 
of a "version(unittest) debug = RBDoChecks;" line.  This looks 
inconsistent.

For RedBlackTree, compile the following with or without -unittest 
option and run for a visible difference in speed (runs 
momentarily or for a few seconds):
-----
import std.container;
void main() {
	auto t = redBlackTree!int;
	foreach (i; 0..3000) t.insert(i);
}
-----

Ivan Kazmenko.


More information about the Digitalmars-d mailing list