public void InsertSameElement_ReturnsSameNode() { const int item = 10; var node = new TwoNode <int>(item, EmptyTwoThree <int> .Instance, EmptyTwoThree <int> .Instance); int splitValue; ITwoThree <int> splitLeft, splitRight; var result = node.Insert(item, Comparer <int> .Default, out splitLeft, out splitRight, out splitValue); Assert.AreSame(node, result); }
public void InsertNewElement_ReturnsThreeNode() { const int first = 10, second = 20; var node = new TwoNode <int>(first, EmptyTwoThree <int> .Instance, EmptyTwoThree <int> .Instance); int splitValue; ITwoThree <int> splitLeft, splitRight; var result = node.Insert(second, Comparer <int> .Default, out splitLeft, out splitRight, out splitValue); Assert.IsNotNull(result); Assert.IsInstanceOf <ThreeNode <int> >(result); }
internal void Register(Dictionary <TwoNode, SameNodeSet> rd, Function f) { Sanity(); refactorused = false; ForEach((n, i) => { var tn = new TwoNode { a = this, b = n, domf = f, pos = i }; SameNodeSet sns; if (!rd.TryGetValue(tn, out sns)) { rd[tn] = sns = new SameNodeSet(); } sns.l.Add(tn); n.Register(rd, f); }); }