Esempio n. 1
0
 public void Test09LbEmpty()
 {
     var arr = new[] { 1, 5, 12, 35, 123 };
     var r = arr.LowerBound(10, 0, 0, (x, y) => x - y);
     Assert.AreEqual(0, r);
     r = arr.LowerBound(11, 2, 2, (x, y) => x - y);
     Assert.AreEqual(2, r);
     r = arr.LowerBound(30, arr.Length, arr.Length, (x, y) => x - y);
     Assert.AreEqual(arr.Length, r);
 }
Esempio n. 2
0
 public void Test07LbBadOrder()
 {
     var arr = new[] { 0, 1, 2 };
     arr.LowerBound(10, arr.Length - 1, 0, (x, y) => x - y);
 }
Esempio n. 3
0
 public void Test05LbBadTo2()
 {
     var arr = new[] { 0 };
     arr.LowerBound(10, 0, arr.Length + 1, (x, y) => x - y);
 }
Esempio n. 4
0
 public void Test03LbBadTo()
 {
     var arr = new[] { 0 };
     arr.LowerBound(10, 0, -1, (x, y) => x - y);
 }
Esempio n. 5
0
 public void Test01LbBadFrom()
 {
     var arr = new[] { 0 };
     arr.LowerBound(10, -1, arr.Length, (x, y) => x - y);
 }
Esempio n. 6
0
 public void Test11Lb()
 {
     var arr = new[] { 1, 5, 12, 12, 123, 512, 512, 14534 };
     var r = arr.LowerBound(15, 0, 3, (x, y) => x - y);
     Assert.AreEqual(3, r);
     r = arr.LowerBound(5, 1, 4, (x, y) => x - y);
     Assert.AreEqual(1, r);
     r = arr.LowerBound(30000);
     Assert.AreEqual(arr.Length, r);
     r = arr.LowerBound(-1);
     Assert.AreEqual(0, r);
     r = arr.LowerBound(42);
     Assert.AreEqual(4, r);
     r = arr.LowerBound(1002);
     Assert.AreEqual(7, r);
     r = arr.LowerBound(12);
     Assert.AreEqual(2, r);
     r = arr.LowerBound(3);
     Assert.AreEqual(1, r);
 }