public void KSort_Index_if_str_is_incorrect() { KSort ksortObj = new KSort(); int index = ksortObj.Index("some string"); int expectedSize = 800; Assert.AreEqual(-1, index); Assert.AreEqual(expectedSize, ksortObj.items.Length); Array.ForEach(ksortObj.items, item => Console.Write((item == null ? "NULL" : item) + " ")); }
public static void TestAdd() { var array = new string[] { "a00", "a01", "b64", "g99", "h99" }; var result = new KSort(array); Assert.IsFalse(result.add("sdfsdf")); Assert.IsFalse(result.add("w23")); Assert.IsFalse(result.add("a123")); var value = "A02"; var i = result.index(value); Assert.IsTrue(result.add(value)); Assert.AreEqual(2, i); Assert.AreEqual("A02", result.items[i]); }
public void KSort_Add_1_if_str_0_is_incorrect() { KSort ksortObj = new KSort(); List <bool> results = new List <bool> { }; results.Add(ksortObj.Add("j26")); int expectedSize = 800; Assert.IsFalse(results.TrueForAll(item => item == true)); Assert.AreEqual(expectedSize, ksortObj.items.Length); Array.ForEach(ksortObj.items, item => Console.Write((item == null ? "NULL" : item) + " ")); }
public void KSort_Add_3_in_Head_and_in_Tail() { KSort ksortObj = new KSort(); ksortObj.Add("a00"); ksortObj.Add("a01"); ksortObj.Add("a02"); ksortObj.Add("h97"); ksortObj.Add("h98"); ksortObj.Add("h99"); int expectedSize = 800; Assert.AreEqual(expectedSize, ksortObj.items.Length); Array.ForEach(ksortObj.items, item => Console.Write((item == null ? "NULL" : item) + " ")); }
public static void TestIndex() { var result = new KSort(); var i = result.index("a00"); Assert.AreEqual(0, i); i = result.index("a01"); Assert.AreEqual(1, i); i = result.index("b64"); Assert.AreEqual(164, i); i = result.index("g99"); Assert.AreEqual(699, i); i = result.index("h99"); Assert.AreEqual(799, i); }
public void KSort_Add_10_in_Head() { KSort ksortObj = new KSort(); List <bool> results = new List <bool> { }; results.Add(ksortObj.Add("a09")); results.Add(ksortObj.Add("a07")); results.Add(ksortObj.Add("a02")); results.Add(ksortObj.Add("a03")); results.Add(ksortObj.Add("a01")); results.Add(ksortObj.Add("a08")); results.Add(ksortObj.Add("a06")); results.Add(ksortObj.Add("a05")); results.Add(ksortObj.Add("a00")); results.Add(ksortObj.Add("a04")); int expectedSize = 800; Assert.IsTrue(results.TrueForAll(item => item == true)); Assert.AreEqual(expectedSize, ksortObj.items.Length); Array.ForEach(ksortObj.items, item => Console.Write((item == null ? "NULL" : item) + " ")); }