コード例 #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);
            });
        }