예제 #1
0
        public async Task LowerVsUpperHashcodeTest()
        {
            var msg        = string.Empty;
            var lowerChars = new string(Enumerable.Range('a', 26).Select(i => (char)i).ToArray());
            var upperChars = new string(Enumerable.Range('A', 26).Select(i => (char)i).ToArray());

            var max   = 10000000L;
            var count = new AtomicInt64();
            await Task.WhenAll(Enumerable.Range(0, Environment.ProcessorCount / 2).Select(n => Task.Run(() =>
            {
                var i = count.Increment();
                while (i <= max)
                {
                    var lower = i.ToBigInt().ToBase(lowerChars);
                    var upper = i.ToBigInt().ToBase(upperChars);
                    var e     = msg = $"Lower: {lower}, Upper: {upper}";
                    Assert.AreNotEqual(lower.GetHashCode(), upper.GetHashCode(), e);
                    i = count.Increment();
                }
            })));

            Console.WriteLine(msg);
        }
예제 #2
0
 public long Next()
 {
     return(seq.Increment());
 }