public void WhenNoNodesAdded_ItRetrurnsNull_AsMaximum() { var rbt = new Rbt <int, int>(Comparer <int> .Create((a, b) => a.CompareTo(b))); var max = rbt.Max(); Assert.IsNull(max); }
public void WhenTwoNodesAdded_ItRetrurnsMaximum() { var rbt = new Rbt <int, int>(Comparer <int> .Create((a, b) => a.CompareTo(b))); rbt.Insert(1, 1); rbt.Insert(10, 10); var max = rbt.Max(); Assert.AreEqual(10, max.Key); Assert.AreEqual(10, max.Value); }
public void WhenSingleNodeAdded_ItIsMaximum() { const int key = 1; const int val = 2; var rbt = new Rbt <int, int>(Comparer <int> .Create((a, b) => a.CompareTo(b))); rbt.Insert(key, val); var max = rbt.Max(); Assert.AreEqual(key, max.Key); Assert.AreEqual(val, max.Value); }