예제 #1
0
        public void Equals_DifferentStringValue_ReturnsFalse()
        {
            string val1 = GenerateString(1020) + "abcd";
            string val2 = GenerateString(1020) + "1234";

            Assert.AreNotEqual(CharSequence.FromValue(val1), CharSequence.FromValue(val2));
        }
예제 #2
0
 public void FromValue_Int()
 {
     for (int i = 0; i < CachedNumberCount + 5; i++)
     {
         Assert.AreSame(CharSequence.FromValue(i), CharSequence.FromValue(i));
     }
 }
예제 #3
0
        public CharSequenceEqualsBenchmarks()
        {
            _strings   = Enumerable.Range(0, StrCount).Select(i => StringGenerator.GenString(StrLength - 4) + "abcd").ToArray();
            _2bStrings = _strings.Select(s => CharSequence.FromValue(s)).ToArray();
            _strings3  = _strings.Select(s => s.Substring(0, StrLength - 4) + "1234").ToArray();

            _strings2   = _strings.Select(s => new string(s)).ToArray();
            _2bStrings2 = _strings2.Select(s => CharSequence.FromValue(s)).ToArray();
            _2bStrings3 = _strings3.Select(s => CharSequence.FromValue(s)).ToArray();
        }
예제 #4
0
        public void FromValue()
        {
            Assert.AreSame(CharSequence.Empty, CharSequence.FromValue(null));
            Assert.AreSame(CharSequence.Empty, CharSequence.FromValue(string.Empty));

            string value = GenerateString(1024);

            Assert.AreSame(CharSequence.FromValue(value), CharSequence.FromValue(value));
            Assert.AreEqual(value, CharSequence.FromValue(value).ToString());

            Assert.AreNotSame(CharSequence.FromValue(value), CharSequence.FromValue(value, true));
        }
        public CharSequenceDictionaryBenchmarks()
        {
            _strings   = Enumerable.Range(0, StrCount).Select(i => StringGenerator.GenString(StrLength)).ToArray();
            _2bStrings = _strings.Select(s => CharSequence.FromValue(s)).ToArray();
            foreach (string s in _strings)
            {
                _strDict[s] = 1;
            }

            foreach (CharSequence s in _2bStrings)
            {
                _2bDict[s] = 1;
            }

            _strings2   = _strings.Select(s => new string(s)).ToArray();
            _2bStrings2 = _strings2.Select(s => CharSequence.FromValue(s)).ToArray();
        }
예제 #6
0
 public void FromValue_Bool()
 {
     Assert.AreSame(CharSequence.True, CharSequence.FromValue(true));
     Assert.AreSame(CharSequence.False, CharSequence.FromValue(false));
 }
 public CharSequenceHashCodeBenchmarks()
 {
     _strings   = Enumerable.Range(0, StrCount).Select(i => StringGenerator.GenString(StrLength)).ToArray();
     _2bStrings = _strings.Select(s => CharSequence.FromValue(s)).ToArray();
 }