コード例 #1
0
        public void Comparisons()
        {
            var a  = "12345678";
            var b  = "12345679";
            var sa = String8.FromString(a);
            var sb = String8.FromString(b);

            Assert.IsFalse(sa.Equals(null));

            Assert.AreEqual(System.Math.Sign(sa.CompareTo(sb)), System.Math.Sign(String.Compare(a, b, StringComparison.Ordinal)));
            Assert.AreEqual(System.Math.Sign(String8.Compare(sa, sb)), System.Math.Sign(String.Compare(a, b, StringComparison.Ordinal)));

            Assert.AreEqual(sa == sb, a == b);
            Assert.AreEqual(String8.Equals(sa, sb), a == b);
            Assert.AreEqual(sa != sb, a != b);

            Assert.IsTrue(sa < sb);
            Assert.IsTrue(sa <= sb);

            Assert.IsFalse(sa > sb);
            Assert.IsFalse(sa >= sb);
        }