示例#1
0
        public void GetStableHashCode_Equivalent()
        {
            var set = new HashSet <int>();

            foreach (var exprs in TestCases.GetExpressionsEquivalent())
            {
                var n = exprs.Select(TestCases.GetHashCode).Distinct().Count();
                Assert.AreEqual(1, n, exprs.First().ToString());
            }
        }
示例#2
0
        public void GetStableHashCode_All_StableLocally()
        {
            RepeatTest(() =>
            {
                var hs1 = TestCases.GetHashes();
                var hs2 = TestCases.GetHashes();

                AssertEqual(hs1, hs2);
            });
        }
示例#3
0
        public void GetStableHashCode_Unique()
        {
            var set = new HashSet <int>();

            foreach (var expr in TestCases.GetExpressionsUnique())
            {
                var h = TestCases.GetHashCode(expr);

                Assert.IsTrue(set.Add(h), expr?.ToString() ?? "null");
            }
        }
示例#4
0
        public void GetStableHashCode_All_CrossProc()
        {
            var local = TestCases.GetHashes().ToArray();

            RepeatTest(() =>
            {
                var hs1 = TestCases.GetHashes();
                var hs2 = GetHashesOutOfProc();

                AssertEqual(hs1, hs2);
            });
        }