public static void TestGetHashCode() { Int64 i1 = 123; Int64 i2 = 654; Assert.NotEqual(0, i1.GetHashCode()); Assert.NotEqual(i1.GetHashCode(), i2.GetHashCode()); }
public void HashCodeHasValueSemantics() { var num1 = new Int64(long.MaxValue); var num2 = new Int64(long.MinValue); var num3 = new Int64(long.MaxValue); Assert.IsTrue(num1.GetHashCode() == num3.GetHashCode()); Assert.IsTrue(num1.GetHashCode() != num2.GetHashCode()); }
public override Int32 GetHashCode() { unchecked { return((397 * _units.GetHashCode()) ^ (_asset?.GetHashCode() ?? 0)); } }
public override int GetHashCode() { return(id.GetHashCode() ^ type.GetHashCode() ^ rotation.GetHashCode() ^ (mesh == null ? 0 : mesh.GetHashCode())); }
/// <summary> /// 获取属性值的哈希码。 /// </summary> /// <returns></returns> public override int GetHashCode() { switch (StorageType) { case StorageType.Boolean: return(Boolean == null ? 0 : Boolean.GetHashCode()); case StorageType.Byte: return(Byte == null ? 0 : Byte.GetHashCode()); case StorageType.Char: return(Char == null ? 0 : Char.GetHashCode()); case StorageType.DateTime: return(DateTime == null ? 0 : DateTime.GetHashCode()); case StorageType.Decimal: return(Decimal == null ? 0 : Decimal.GetHashCode()); case StorageType.Double: return(Double == null ? 0 : Double.GetHashCode()); case StorageType.Enum: return(Enum == null ? 0 : Enum.GetHashCode()); case StorageType.Guid: return(Guid == null ? 0 : Guid.GetHashCode()); case StorageType.Int16: return(Int16 == null ? 0 : Int16.GetHashCode()); case StorageType.Int32: return(Int32 == null ? 0 : Int32.GetHashCode()); case StorageType.Int64: return(Int64 == null ? 0 : Int64.GetHashCode()); case StorageType.Single: return(Single == null ? 0 : Single.GetHashCode()); case StorageType.String: return(String == null ? 0 : String.GetHashCode()); case StorageType.TimeSpan: return(TimeSpan == null ? 0 : TimeSpan.GetHashCode()); } return(base.GetHashCode()); }
/// <summary> /// local implementation of GetHashCode based on unique value members /// </summary> public override int GetHashCode() { int hash = 57; hash = 27 * hash * id.GetHashCode(); return(hash); }
public override int GetHashCode() { return(Type.GetHashCode() ^ SolarSystemId.GetHashCode() ^ EntityId.GetHashCode() ^ WarpToDistance.GetHashCode() ^ FleetMemberId.GetHashCode() ^ FleetMemberEntityId.GetHashCode() ^ MissionAgentId.GetHashCode() ^ BookMarkId.GetHashCode() ^ Distance.GetHashCode() ^ FleetMemberName.GetHashCode() ^ BookMarkTypeTag.GetHashCode() ^ UseGate.GetHashCode() ^ Dock.GetHashCode()); }
public void TestGetHashCode() { try { MyInt64_1.GetHashCode(); MyInt64_2.GetHashCode(); MyInt64_3.GetHashCode(); } catch { Assert.Fail("GetHashCode should not raise an exception here"); } }
private void CalcHashCode() { if (VertexIDs != null && VertexIDs.Count() > 0) { foreach (var aIncomingVertex in VertexIDs) { _hashCode = _hashCode ^ aIncomingVertex.GetHashCode(); } } _hashCode = _hashCode ^ VertexTypeID.GetHashCode() ^ PropertyID.GetHashCode() ^ VertexEditionName.GetHashCode() ^ VertexRevisionID.GetHashCode(); }
public override int GetHashCode() { unchecked { int hashCode = SByte.GetHashCode(); hashCode = (hashCode * 397) ^ Byte.GetHashCode(); hashCode = (hashCode * 397) ^ Int16.GetHashCode(); hashCode = (hashCode * 397) ^ UInt16.GetHashCode(); hashCode = (hashCode * 397) ^ Int32; hashCode = (hashCode * 397) ^ (int)UInt32; hashCode = (hashCode * 397) ^ Int64.GetHashCode(); hashCode = (hashCode * 397) ^ UInt64.GetHashCode(); hashCode = (hashCode * 397) ^ Single.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ Char.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { int hashCode = BooleanFalse.GetHashCode(); hashCode = (hashCode * 397) ^ BooleanTrue.GetHashCode(); hashCode = (hashCode * 397) ^ Char.GetHashCode(); hashCode = (hashCode * 397) ^ SByte.GetHashCode(); hashCode = (hashCode * 397) ^ Byte.GetHashCode(); hashCode = (hashCode * 397) ^ Int16.GetHashCode(); hashCode = (hashCode * 397) ^ UInt16.GetHashCode(); hashCode = (hashCode * 397) ^ Int32; hashCode = (hashCode * 397) ^ (int)UInt32; hashCode = (hashCode * 397) ^ Int64.GetHashCode(); hashCode = (hashCode * 397) ^ UInt64.GetHashCode(); hashCode = (hashCode * 397) ^ Single.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ String.GetHashCode(); hashCode = (hashCode * 397) ^ DateTime.GetHashCode(); hashCode = (hashCode * 397) ^ DateTimeOffset.GetHashCode(); hashCode = (hashCode * 397) ^ Guid.GetHashCode(); hashCode = (hashCode * 397) ^ NonGenericType.GetHashCode(); hashCode = (hashCode * 397) ^ GenericTypeDefinition.GetHashCode(); hashCode = (hashCode * 397) ^ ClosedConstructedGenericType.GetHashCode(); hashCode = (hashCode * 397) ^ (NullReference != null ? NullReference.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Enum_S8.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U8.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_S16.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U16.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_S32.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U32.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_S64.GetHashCode(); hashCode = (hashCode * 397) ^ Enum_U64.GetHashCode(); hashCode = (hashCode * 397) ^ SerializableObject.GetHashCode(); hashCode = (hashCode * 397) ^ ByteArrayEqualityComparer.GetHashCode(Buffer1); hashCode = (hashCode * 397) ^ ByteArrayEqualityComparer.GetHashCode(Buffer2); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = Boolean.GetHashCode(); hashCode = (hashCode * 397) ^ NullableBoolean.GetHashCode(); hashCode = (hashCode * 397) ^ Byte.GetHashCode(); hashCode = (hashCode * 397) ^ NullableByte.GetHashCode(); hashCode = (hashCode * 397) ^ SByte.GetHashCode(); hashCode = (hashCode * 397) ^ NullableSByte.GetHashCode(); hashCode = (hashCode * 397) ^ Char.GetHashCode(); hashCode = (hashCode * 397) ^ NullableChar.GetHashCode(); hashCode = (hashCode * 397) ^ Decimal.GetHashCode(); hashCode = (hashCode * 397) ^ NullableDecimal.GetHashCode(); hashCode = (hashCode * 397) ^ Double.GetHashCode(); hashCode = (hashCode * 397) ^ NullableDouble.GetHashCode(); hashCode = (hashCode * 397) ^ Single.GetHashCode(); hashCode = (hashCode * 397) ^ NullableSingle.GetHashCode(); hashCode = (hashCode * 397) ^ Int32; hashCode = (hashCode * 397) ^ NullableInt32.GetHashCode(); hashCode = (hashCode * 397) ^ (int)UInt32; hashCode = (hashCode * 397) ^ NullableUInt32.GetHashCode(); hashCode = (hashCode * 397) ^ Int64.GetHashCode(); hashCode = (hashCode * 397) ^ NullableInt64.GetHashCode(); hashCode = (hashCode * 397) ^ UInt64.GetHashCode(); hashCode = (hashCode * 397) ^ NullableUInt64.GetHashCode(); hashCode = (hashCode * 397) ^ Int16.GetHashCode(); hashCode = (hashCode * 397) ^ NullableInt16.GetHashCode(); hashCode = (hashCode * 397) ^ UInt16.GetHashCode(); hashCode = (hashCode * 397) ^ NullableUInt16.GetHashCode(); hashCode = (hashCode * 397) ^ (int)Enum; hashCode = (hashCode * 397) ^ NullableEnum.GetHashCode(); hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Nested != null ? Nested.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { return(Counter.GetHashCode()); }
public override int GetHashCode() { return(cx.GetHashCode() * 17 + cy.GetHashCode()); }
public void Remove(Int64 guid) { HashSetArray[(guid.GetHashCode() & 0x7fffffff) % m].Remove(guid); }
/// <summary> /// Serves as a hash function for a <see cref="T:com.CIMthetics.CSharpSECSTools.SECSItems.I8SECSItem"/> object. /// </summary> /// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a /// hash table.</returns> public override int GetHashCode() { return(value.GetHashCode()); }
public override int GetHashCode() { return(image_id.GetHashCode() + image_state.GetHashCode()); }
public override int GetHashCode() { return(Raw.GetHashCode()); }
public override Int32 GetHashCode() { return(207501131 ^ _units.GetHashCode() ^ _döviz.GetHashCode()); }
public virtual bool runTest() { Console.Error.WriteLine("Co1632Cons_Eq_GV_GHC runTest started."); Console.Out.WriteLine(""); Console.Out.WriteLine("Method_Covered: Integer8.Equals(Object obj)"); Console.Out.WriteLine("Method_Covered: Integer8.GetValue ()"); Console.Out.WriteLine("Method_Covered: Integer8.GetHashCode ()"); Console.Out.WriteLine("Method_Count==3 (Co1632Cons_Eq_GV_GHC)"); Console.Out.WriteLine(""); String strLoc = "Loc_000oo"; StringBuilder sblMsg = new StringBuilder(99); int iCountErrors = 0; int iCountTestcases = 0; String str0 = null; String str2 = null; StringBuilder sbl5 = new StringBuilder(99); int in_4e = -2; long lo8z = -2L; long lo8y = -2L; Int32 int4c = 0; Int64 int8a = 0L; Int64 int8b = 0L; try { LABEL_860_GENERAL: do { lo8z = 3L; strLoc = "Loc_110th"; sbl5.Length = 0; str0 = sbl5.Append(lo8z).ToString(); int8a = (Int64)(lo8z); int8b = (Int64)(lo8z); in_4e = int8a.GetHashCode(); ++iCountTestcases; if ((int)lo8z != in_4e) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_184pr! lo8y==" + lo8y); } lo8y = int8a; ++iCountTestcases; if (lo8z != lo8y) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_125ci! lo8y==" + lo8y); } str2 = int8a.ToString(); ++iCountTestcases; if (!str2.Equals(str0)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_144ye! str2==" + str2); } ++iCountTestcases; if (!int8a.Equals(int8b)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_199nd! lo8z==" + lo8z); } lo8z = -4L; strLoc = "Loc_120tr"; sbl5.Length = 0; str0 = sbl5.Append(lo8z).ToString(); int8a = (Int64)(lo8z); int8b = (Int64)(lo8z); in_4e = int8a.GetHashCode(); ++iCountTestcases; if ((int)lo8z + 1 != -in_4e) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_184zl! -lo8y==" + -lo8y); } lo8y = int8a; ++iCountTestcases; if (lo8z != lo8y) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_125wa! lo8y==" + lo8y); } str2 = int8a.ToString(); ++iCountTestcases; if (!str2.Equals(str0)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_144dy! str2==" + str2); } ++iCountTestcases; if (!int8a.Equals(int8b)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_199uc! lo8z==" + lo8z); } lo8z = Int64.MinValue; strLoc = "Loc_220nv"; sbl5.Length = 0; str0 = sbl5.Append(lo8z).ToString(); int8a = (Int64)(lo8z); int8b = (Int64)(lo8z); in_4e = int8a.GetHashCode(); ++iCountTestcases; if (in_4e != Int32.MinValue) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_284pr! ( -lo8z + 1 )==" + (-(int)lo8z)); } lo8y = int8a; ++iCountTestcases; if (lo8z != lo8y) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_225ci! lo8y==" + lo8y); } str2 = int8a.ToString(); ++iCountTestcases; if (!str2.Equals(str0)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_244ye! str2==" + str2); } ++iCountTestcases; if (!int8a.Equals(int8b)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_299nd! lo8z==" + lo8z); } lo8z = Int64.MaxValue; strLoc = "Loc_330xv"; sbl5.Length = 0; str0 = sbl5.Append(lo8z).ToString(); int8a = (Int64)(lo8z); int8b = (Int64)(lo8z); in_4e = int8a.GetHashCode(); if (in_4e != Int32.MinValue) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_384pr! lo8z==" + (int)lo8z); } lo8y = int8a; ++iCountTestcases; if (lo8z != lo8y) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_325ci! lo8y==" + lo8y); } str2 = int8a.ToString(); ++iCountTestcases; if (!str2.Equals(str0)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_344ye! str2==" + str2); } ++iCountTestcases; if (!int8a.Equals(int8b)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_399nd! lo8z==" + lo8z); } lo8z = -0L; strLoc = "Loc_440nz"; sbl5.Length = -0; str0 = sbl5.Append(lo8z).ToString(); int8a = (Int64)(lo8z); int8b = (Int64)(lo8z); in_4e = int8a.GetHashCode(); ++iCountTestcases; if ((int)lo8z != in_4e) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_484pr! lo8y==" + lo8y); } lo8y = int8a; ++iCountTestcases; if (lo8z != lo8y) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_425ci! lo8y==" + lo8y); } str2 = int8a.ToString(); ++iCountTestcases; if (!str2.Equals(str0)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_444ye! str2==" + str2); } ++iCountTestcases; if (!int8a.Equals(int8b)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_499nd! lo8z==" + lo8z); } ++iCountTestcases; if (!str2.Equals("0")) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_461vj! str2==" + str2); } int4c = (Int32)(-0); ++iCountTestcases; if (!int8a.Equals(int4c)) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_462mj! int4c.ToString()==" + int4c.ToString()); } int max = 0; Hashtable hDup = new Hashtable(); strLoc = "Loc_920dz"; for (Int64 testI = -100; testI < 100; testI++) { iCountTestcases++; if (testI.GetHashCode() < 0) { iCountErrors++; Console.WriteLine("ERROR Err_9284pp: The Hash code for " + testI + " is negative "); } try { hDup.Add(testI.GetHashCode(), 0); } catch (ArgumentException argexc) { hDup[testI.GetHashCode()] = (int)hDup[testI.GetHashCode()] + 1; if ((int)hDup[testI.GetHashCode()] > max) { max = (int)hDup[testI.GetHashCode()]; } } } Console.WriteLine("INFO: In_893 Maximum Duplicate hash codes that exist: " + max); if (max > 5) { iCountErrors++; Console.WriteLine("ERROR Err_9284zz: TOO MANY DUPLICATE HASH CODES"); } } while (false); } catch (Exception exc_general) { ++iCountErrors; Console.Error.WriteLine("POINTTOBREAK: Error Err_343un! (Co1632Cons_Eq_GV_GHC) exc_general==" + exc_general); Console.Error.WriteLine("EXTENDEDINFO: (Err_343un) strLoc==" + strLoc); } if (iCountErrors == 0) { Console.Error.WriteLine("paSs. Integer8\\Co1632Cons_Eq_GV_GHC.cs iCountTestcases==" + iCountTestcases); return(true); } else { Console.Error.WriteLine("FAiL! Integer8\\Co1632Cons_Eq_GV_GHC.cs iCountErrors==" + iCountErrors); return(false); } }
/// <summary> /// Returns the hash code for this instance. /// </summary> /// <returns>A 32-bit signed integer that is the hash code for this instance.</returns> public override Int32 GetHashCode() { return(_ticks.GetHashCode() ^ 965800937); }
public override int GetHashCode() { return(m_DiscreteTime.GetHashCode()); }
public override int GetHashCode() { return(47 * s.GetHashCode() + 36425232 * t.GetHashCode()); }
public override int GetHashCode() => unchecked (Alias.GetHashCode() * intvalue.GetHashCode());
public override int GetHashCode() { return(opdata.GetHashCode() ^ optype.GetHashCode() ^ metaData.GetHashCode()); }
public override int GetHashCode() => value.GetHashCode();
public override int GetHashCode(Point p) { Int64 x = (Int64)(p.X * Point.EpsilonInv) + (Int64)(p.X * Point.EpsilonInv); return(x.GetHashCode()); }
public override int GetHashCode() { return(hi.GetHashCode() ^ lo.GetHashCode()); }
/// <summary> /// Gets hash code</summary> /// <returns> /// Hash code</returns> public override int GetHashCode() { return(_languageID.GetHashCode() ^ _textKey.GetHashCode()); }
public override int GetHashCode() { return(m_first.GetHashCode() ^ m_second.GetHashCode()); }