public void SpanString1FromSlice() { var ss = new SpanString1("ABCDEFG", 2, 3); Assert.AreEqual(3, ss.Length); Assert.AreEqual(0, ss.CompareTo(new SpanString1("CDE"))); Assert.AreEqual(ss.GetHashCode(), (new SpanString1("CDE")).GetHashCode()); Assert.AreEqual(ss.GetHashCodeIgnoreCase(), (new SpanString1("CDE")).GetHashCodeIgnoreCase()); Assert.AreEqual(ss.GetHashCodeIgnoreCase(), (new SpanString1("cde")).GetHashCodeIgnoreCase()); Assert.AreNotEqual(0, ss.CompareTo(new SpanString1("cde"))); Assert.AreNotEqual(ss.GetHashCode(), (new SpanString1("cde")).GetHashCode()); Assert.AreEqual(0, ss.CompareTo(new SpanString1("cde"), true)); }
public void SpanString1FromFullString() { var ss = new SpanString1("ABCDEFG"); Assert.AreEqual(7, ss.Length); Assert.AreEqual(0, ss.CompareTo(new SpanString1("ABCDEFG"))); Assert.AreEqual(ss.GetHashCode(), (new SpanString1("ABCDEFG")).GetHashCode()); Assert.AreEqual(ss.GetHashCodeIgnoreCase(), (new SpanString1("ABCDEFG")).GetHashCodeIgnoreCase()); Assert.AreEqual(ss.GetHashCodeIgnoreCase(), (new SpanString1("abcdefg")).GetHashCodeIgnoreCase()); Assert.AreNotEqual(0, ss.CompareTo(new SpanString1("abcdefg"))); Assert.AreNotEqual(ss.GetHashCode(), (new SpanString1("abcdefg")).GetHashCode()); Assert.AreEqual(0, ss.CompareTo(new SpanString1("abcdefg"), true)); }