コード例 #1
0
        public void Equals_4()
        {
            var a = new SparseArray <char>(20);

            a[1] = 'a';

            var b = new SparseArray <char>(10);

            b[1] = 'b';

            Assert.IsFalse(b.Equals(a));
        }
コード例 #2
0
        public void Equals_5()
        {
            var a = new SparseArray <char>(4, new KeyValuePair <int, char>[]
            {
                new KeyValuePair <int, char>(0, 'a'),
                new KeyValuePair <int, char>(1, 'b'),
                new KeyValuePair <int, char>(2, 'c'),
                new KeyValuePair <int, char>(3, 'd'),
            });

            var b = new SparseArray <char>(new char[] { 'a', 'b', 'c', 'd' });

            Assert.IsTrue(a.Equals(b));
        }
コード例 #3
0
        public void Equals_3()
        {
            var a = new SparseArray <char>(20);

            a.Set(1, 'a');
            a.Set(2, 'b');
            a.Set(3, 'c');
            a.Set(4, 'd');
            a.Set(5, 'e');

            var b = new SparseArray <char>(10);

            b.Set(1, 'a');
            b.Set(5, 'e');
            b.Set(3, 'c');
            b.Set(2, 'b');
            b.Set(4, 'd');

            Assert.IsFalse(b.Equals(a));
        }
コード例 #4
0
        public void Equals_1()
        {
            var a = new SparseArray <char>(10, new KeyValuePair <int, char>[]
            {
                new KeyValuePair <int, char>(1, 'a'),
                new KeyValuePair <int, char>(2, 'b'),
                new KeyValuePair <int, char>(3, 'c'),
                new KeyValuePair <int, char>(4, 'd'),
                new KeyValuePair <int, char>(5, 'e')
            });

            var b = new SparseArray <char>(10);

            b[1] = 'a';
            b[5] = 'e';
            b[3] = 'c';
            b[2] = 'b';
            b[4] = 'd';

            Assert.IsTrue(a.Equals(b));
        }