public void StrSegLocateWorks() { Assert.AreEqual(0, MHString.StrSegLocate("ABC", "", 1, 1, ',', false), 0, "t1"); Assert.AreEqual(0, MHString.StrSegLocate("", "123,456,789", 1, 1, ',', false), "t1"); Assert.AreEqual(2, MHString.StrSegLocate("ABC", "def,abc", 1, 1, ',', false), "t2"); Assert.AreEqual(2, MHString.StrSegLocate("ABC", "def,abc", 2, 1, ',', false), "t3"); Assert.AreEqual(0, MHString.StrSegLocate("abc", "def,abc", 3, 1, ',', false), "t4"); Assert.AreEqual(2, MHString.StrSegLocate("456", "123,456,789", 1, 1, ',', true), "t5"); Assert.AreEqual(0, MHString.StrSegLocate("xyz", "123,456,789", 1, 1, ',', true), "t6"); Assert.AreEqual(0, MHString.StrSegLocate("45", "123,456,789", 1, 1, ',', true), "t7"); Assert.AreEqual(0, MHString.StrSegLocate("456", "123,456,789", 1, 2, ',', true), "t8"); // IncBy is 2, so it should skip the 2nd value during checking Assert.AreEqual(3, MHString.StrSegLocate("789", "123,456,789", 1, 1, ',', true), "t9"); Assert.AreEqual(0, MHString.StrSegLocate("9", "123,456,789", 1, 1, ',', true), "t10"); Assert.AreEqual(0, MHString.StrSegLocate("1", "123,456,789", 1, 1, ',', true), "t11"); Assert.AreEqual(0, MHString.StrSegLocate("123", "123,456,789", 2, 1, ',', true), "t12"); // we are starting at segment 2, so no hit Assert.AreEqual(2, MHString.StrSegLocate("456", "123,456,789", 2, 1, ',', true), "t13"); // we are starting at segment 2, so it should hit Assert.AreEqual(3, MHString.StrSegLocate("789", "123,456,789", 1, 2, ',', true), "t14"); Assert.AreEqual(2, MHString.StrSegLocate("AB" + "c", "def,abc", 1, 1, ',', false), "t15"); }