Example #1
0
        public void HashCodeSameAsPersistentVector()
        {
            MapEntry         me = new MapEntry(1, "abc");
            PersistentVector v  = PersistentVector.create(1, "abc");

            Expect(me.GetHashCode()).To.Equal(v.GetHashCode());
        }
Example #2
0
        public void HashCodeFalseOnDifferentValues()
        {
            MapEntry         me = new MapEntry(1, "abc");
            PersistentVector v  = PersistentVector.create(1, "abcd");

            Expect(me.GetHashCode()).To.Not.Equal(v.GetHashCode());
        }
Example #3
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                if (__isset.primitiveEntry)
                {
                    hashcode = (hashcode * 397) + PrimitiveEntry.GetHashCode();
                }
                if (__isset.arrayEntry)
                {
                    hashcode = (hashcode * 397) + ArrayEntry.GetHashCode();
                }
                if (__isset.mapEntry)
                {
                    hashcode = (hashcode * 397) + MapEntry.GetHashCode();
                }
                if (__isset.structEntry)
                {
                    hashcode = (hashcode * 397) + StructEntry.GetHashCode();
                }
                if (__isset.unionEntry)
                {
                    hashcode = (hashcode * 397) + UnionEntry.GetHashCode();
                }
                if (__isset.userDefinedTypeEntry)
                {
                    hashcode = (hashcode * 397) + UserDefinedTypeEntry.GetHashCode();
                }
            }
            return(hashcode);
        }