public void GetMaxAndGetMinLIFOIfNoComparerSupplied() { testSet.Add(1, "a"); testSet.Add(2, "b"); testSet.Add(3, "c"); testSet.Add(4, "d"); Assert.AreEqual("d", testSet.GetMax(false)); Assert.AreEqual("c", testSet.GetMax(false)); testSet.Clear(); }
public void GetMaxOrGetMinOnlyReSortsWhenArgIsTrue() { var testSet2 = new SecureSortedSet <int, float[]>((float[] x, float[] y) => Sum(x) <= Sum(y) ? -1 : 1); float[] b = { 0.4f, 0.4f, 0.4f }; float[] d = { 1.4f, 1.4f, 1.4f }; testSet2.Add(1, new float[] { 0.1f, 0.1f, 0.1f }); testSet2.Add(2, b); testSet2.Add(3, new float[] { 0.8f, 0.8f, 0.8f }); testSet2.Add(4, d); Assert.AreSame(d, testSet2.GetMax(false)); b[0] = 20; Assert.AreSame(b, testSet2.GetMax(true)); testSet2.Add(2, b); b[0] = 0.01f; b[1] = 0.02f; b[2] = 0.02f; Assert.AreSame(b, testSet2.GetMin(true)); testSet2.Add(2, b); b[0] = 200; Assert.AreSame(b, testSet2.GetMin(false)); }