Example #1
0
        public void Trees_compare_theirProton()
        {
            var a = Sigo.Create(3, "k", "v");
            var b = Sigo.Create(0, "k", "v");

            SigoAssert.NotEqual(a, b);
        }
Example #2
0
        public void If_sigosAreEqual_then_hashsAreEqual()
        {
            var sigos = new List <ISigo> {
                Sigo.From("a"),
                Sigo.From("a"),
                Sigo.From("b"),
                Sigo.Create(0),
                Sigo.Create(3),
                Sigo.Create(1, "x", "1", "y", "2").Freeze(),
                Sigo.Create(1, "y", "2", "x", "1"),
                Sigo.Create(1, "y", "2", "x", "2"),
                Sigo.Create(1, "diff", "2", "x", "1")
            };

            foreach (var a in sigos)
            {
                foreach (var b in sigos)
                {
                    if (a.Equals(b))
                    {
                        // THIS IS A MUST
                        SigoAssert.Equal(Hash(a), Hash(b));
                    }
                    else
                    {
                        // THIS IS A SHOULD
                        SigoAssert.NotEqual(Hash(a), Hash(b));
                    }
                }
            }
        }
Example #3
0
        public void Trees_compare_deeply()
        {
            var a1 = Sigo.Create(0, "a/b/c/d", "v+");
            var a2 = Sigo.Create(0, "a/b/c/d", "v+");
            var b1 = Sigo.Create(0, "a/b/c/d", "v-");

            SigoAssert.Equal(a1, a2);
            SigoAssert.NotEqual(a1, b1);
        }
Example #4
0
        public void Trees_dontCompare_theirChildOder()
        {
            var a = Sigo.Create(3, "k1", "v1", "k2", "v2");
            var b = Sigo.Create(3, "k2", "v2", "k1", "v1");

            SigoAssert.NotEqual(a.Keys.First(), b.Keys.First());

            SigoAssert.Equal(a, b);
        }
Example #5
0
        public void Trees_dontCompare_theirNeutron()
        {
            var a = Sigo.Create(3, "k", "v");
            var b = Sigo.Create(3, "k", "v").Freeze();

            SigoAssert.NotEqual(a.Flags, b.Flags);

            SigoAssert.Equal(a, b);
        }
Example #6
0
        public void Trees_compare_theirChildren()
        {
            var a = Sigo.Create(0, "k", "v+");
            var b = Sigo.Create(0, "k", "v+");
            var c = Sigo.Create(0, "k", "v-");

            SigoAssert.Equal(a, b);
            SigoAssert.NotEqual(b, c);
        }
Example #7
0
        public void Compare_aListOf_differenceValues()
        {
            var diffs = new List <ISigo> {
                Sigo.From(true),
                Sigo.From(false),
                Sigo.From(1),
                Sigo.From(2),
                Sigo.From("a"),
                Sigo.From("b")
            };

            for (var i = 0; i < 8; i++)
            {
                diffs.Add(Sigo.Create(i));
            }

            diffs.Add(Sigo.Create(0, "x", 1));
            diffs.Add(Sigo.Create(0, "x", 2));
            diffs.Add(Sigo.Create(0, "y", 1));
            diffs.Add(Sigo.Create(0, "y", 2));

            diffs.Add(Sigo.Create(3, "x", 1));
            diffs.Add(Sigo.Create(3, "x", 2));
            diffs.Add(Sigo.Create(3, "y", 1));
            diffs.Add(Sigo.Create(3, "y", 2));

            foreach (var a in diffs)
            {
                foreach (var b in diffs)
                {
                    if (!a.Same(b))
                    {
                        SigoAssert.NotEqual(a, b);
                    }
                }
            }
        }