[Issue 14082] New: RedBlackTree unittest fails with custom predicate less
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jan 30 05:42:36 PST 2015
https://issues.dlang.org/show_bug.cgi?id=14082
Issue ID: 14082
Summary: RedBlackTree unittest fails with custom predicate less
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: drug2004 at bk.ru
import std.container: RedBlackTree;
class Test(T, alias less = "a<b")
{
alias Container = RedBlackTree!(T, less);
}
unittest
{
alias Foo = Test!(int);
}
void main() {}
run using rdmd -unittest filename.d
this code causes unittest failure:
std/container/rbtree.d
Lines 846-850:
static if(less == "a < b")
auto vals = [1, 2, 3, 4, 5];
else
auto vals = [5, 4, 3, 2, 1];
assert(equal(r, vals));
because less is set to "a<b" instead of "a < b" by default, i.e. spaces have
meaning here. What is the best way to fix that?
--
More information about the Digitalmars-d-bugs
mailing list