public void GetHashCodeTest() { BigInteger target = new BigInteger(); // TODO: Initialize to an appropriate value int expected = 0; // TODO: Initialize to an appropriate value int actual; actual = target.GetHashCode(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public override int GetHashCode() { return(x.GetHashCode() ^ base.GetHashCode()); }
public override int GetHashCode() { return((_a.GetHashCode() / _b.GetHashCode()).GetHashCode()); }
public override int GetHashCode() { return(bigInt.GetHashCode() ^ scale); }
public static int Hash(BigInteger /*!*/ self) { return(self.GetHashCode()); }
public override int GetHashCode() => UUID.GetHashCode() ^ Amount.GetHashCode() ^ Operation.GetHashCode();
// IComparable required methods. /// <summary> /// (From zencoders implemementation) /// Method used to get the hash code according to the algorithm: /// http://stackoverflow.com/questions/16340/how-do-i-generate-a-hashcode-from-a-byte-array-in-c/425184#425184 /// </summary> /// <returns>Integer representing the hashcode</returns> public override int GetHashCode() { return(id.GetHashCode()); }
public override int GetHashCode() { return(number.GetHashCode()); }
public override int GetHashCode() { return(amount.GetHashCode()); }
public override int GetHashCode() { return(Q.GetHashCode() ^ x.GetHashCodeExt(0, 8)); }
public override int GetHashCode() { return(curve.GetHashCode() ^ g.GetHashCode() ^ n.GetHashCode() ^ h.GetHashCode() ^ Arrays.GetHashCode(seed)); }
public override int GetHashCode() => Data.GetHashCode();
public override int GetHashCode() { return(p.GetHashCode() ^ q.GetHashCode() ^ a.GetHashCode()); }
public override int GetHashCode() { return(IsIntegral ? bigIntValue.GetHashCode() : doubleValue.GetHashCode()); }
public static int __hash__(BigInteger self) { #if CLR4 // TODO: we might need our own hash code implementation. This avoids assertion failure. if (self == -2147483648) { return -2147483648; } #endif // Call the DLR's BigInteger hash function, which will return an int32 representation of // b if b is within the int32 range. We use that as an optimization for hashing, and // assert the assumption below. int hash = self.GetHashCode(); #if DEBUG int i; if (self.AsInt32(out i)) { Debug.Assert(i == hash, String.Format("hash({0}) == {1}", i, hash)); } #endif return hash; }
public override int GetHashCode() { return(_Satoshis.GetHashCode()); }
private static void VerifyComparison(BigInteger x, bool IsXNegative, BigInteger y, bool IsYNegative, int expectedResult) { bool expectedEquals = 0 == expectedResult; bool expectedLessThan = expectedResult < 0; bool expectedGreaterThan = expectedResult > 0; if (IsXNegative == true) { x = x * -1; } if (IsYNegative == true) { y = y * -1; } Assert.Equal(expectedEquals, x == y); Assert.Equal(expectedEquals, y == x); Assert.Equal(!expectedEquals, x != y); Assert.Equal(!expectedEquals, y != x); Assert.Equal(expectedEquals, x.Equals(y)); Assert.Equal(expectedEquals, y.Equals(x)); Assert.Equal(expectedEquals, x.Equals((Object)y)); Assert.Equal(expectedEquals, y.Equals((Object)x)); VerifyCompareResult(expectedResult, x.CompareTo(y), "x.CompareTo(y)"); VerifyCompareResult(-expectedResult, y.CompareTo(x), "y.CompareTo(x)"); if (expectedEquals) { Assert.Equal(x.GetHashCode(), y.GetHashCode()); Assert.Equal(x.ToString(), y.ToString()); } Assert.Equal(x.GetHashCode(), x.GetHashCode()); Assert.Equal(y.GetHashCode(), y.GetHashCode()); Assert.Equal(expectedLessThan, x < y); Assert.Equal(expectedGreaterThan, y < x); Assert.Equal(expectedGreaterThan, x > y); Assert.Equal(expectedLessThan, y > x); Assert.Equal(expectedLessThan || expectedEquals, x <= y); Assert.Equal(expectedGreaterThan || expectedEquals, y <= x); Assert.Equal(expectedGreaterThan || expectedEquals, x >= y); Assert.Equal(expectedLessThan || expectedEquals, y >= x); }
public override int GetHashCode() { return(p.GetHashCode() ^ g.GetHashCode() ^ l); }
public override int GetHashCode() { return(_Target.GetHashCode()); }
public override int GetHashCode() => (Q.GetHashCode() ^ Arrays.GetHashCode(this.x, 0, 0x11));
public override int GetHashCode() { return(certainty.GetHashCode() ^ publicExponent.GetHashCode()); }
public override int GetHashCode() { // ReSharper disable once ImpureMethodCallOnReadonlyValueField return(_value.GetHashCode()); }
public override int GetHashCode() { return(modulus.GetHashCode() ^ exponent.GetHashCode() ^ IsPrivate.GetHashCode()); }
public override int GetHashCode() { return(Q.GetHashCode() ^ Arrays.GetHashCode(this.x, 0, 8)); }
public override int GetHashCode() { return(characteristic.GetHashCode()); }
/// <summary> /// Gets a hash code for this. /// </summary> /// <returns>A hash code.</returns> public override int GetHashCode() { return(_numerator.GetHashCode() ^ _denominator.GetHashCode()); }
public override int GetHashCode() { return(Q.GetHashCode() ^ Arrays.GetHashCode(x, 0, 5)); }
/// <summary> /// /// </summary> /// <returns></returns> public override int GetHashCode() { return(_bigIntValue.GetHashCode() ^ _decimalCount.GetHashCode()); }
public override int GetHashCode() { return(Value.GetHashCode()); }
public override int GetHashCode() => (int)((Scale + 31 * (long)IntVal.GetHashCode()) % 2147483647);
private static void VerifyComparison(BigInteger x, BigInteger y, int expectedResult) { bool expectedEquals = 0 == expectedResult; bool expectedLessThan = expectedResult < 0; bool expectedGreaterThan = expectedResult > 0; Assert.Equal(expectedEquals, x == y); Assert.Equal(expectedEquals, y == x); Assert.Equal(!expectedEquals, x != y); Assert.Equal(!expectedEquals, y != x); Assert.Equal(expectedEquals, x.Equals(y)); Assert.Equal(expectedEquals, y.Equals(x)); Assert.Equal(expectedEquals, x.Equals((Object)y)); Assert.Equal(expectedEquals, y.Equals((Object)x)); VerifyCompareResult(expectedResult, x.CompareTo(y), "x.CompareTo(y)"); VerifyCompareResult(-expectedResult, y.CompareTo(x), "y.CompareTo(x)"); IComparable comparableX = x; IComparable comparableY = y; VerifyCompareResult(expectedResult, comparableX.CompareTo(y), "comparableX.CompareTo(y)"); VerifyCompareResult(-expectedResult, comparableY.CompareTo(x), "comparableY.CompareTo(x)"); VerifyCompareResult(expectedResult, BigInteger.Compare(x, y), "Compare(x,y)"); VerifyCompareResult(-expectedResult, BigInteger.Compare(y, x), "Compare(y,x)"); if (expectedEquals) { Assert.Equal(x.GetHashCode(), y.GetHashCode()); Assert.Equal(x.ToString(), y.ToString()); } Assert.Equal(x.GetHashCode(), x.GetHashCode()); Assert.Equal(y.GetHashCode(), y.GetHashCode()); Assert.Equal(expectedLessThan, x < y); Assert.Equal(expectedGreaterThan, y < x); Assert.Equal(expectedGreaterThan, x > y); Assert.Equal(expectedLessThan, y > x); Assert.Equal(expectedLessThan || expectedEquals, x <= y); Assert.Equal(expectedGreaterThan || expectedEquals, y <= x); Assert.Equal(expectedGreaterThan || expectedEquals, x >= y); Assert.Equal(expectedLessThan || expectedEquals, y >= x); }
public override int GetHashCode() { return base.GetHashCode() ^ q.GetHashCode(); }
private static void VerifyComparison(BigInteger x, UInt64 y, int expectedResult) { bool expectedEquals = 0 == expectedResult; bool expectedLessThan = expectedResult < 0; bool expectedGreaterThan = expectedResult > 0; Assert.Equal(expectedEquals, x == y); Assert.Equal(expectedEquals, y == x); Assert.Equal(!expectedEquals, x != y); Assert.Equal(!expectedEquals, y != x); Assert.Equal(expectedEquals, x.Equals(y)); VerifyCompareResult(expectedResult, x.CompareTo(y), "x.CompareTo(y)"); if (expectedEquals) { Assert.Equal(x.GetHashCode(), ((BigInteger)y).GetHashCode()); Assert.Equal(x.ToString(), ((BigInteger)y).ToString()); } Assert.Equal(x.GetHashCode(), x.GetHashCode()); Assert.Equal(((BigInteger)y).GetHashCode(), ((BigInteger)y).GetHashCode()); Assert.Equal(expectedLessThan, x < y); Assert.Equal(expectedGreaterThan, y < x); Assert.Equal(expectedGreaterThan, x > y); Assert.Equal(expectedLessThan, y > x); Assert.Equal(expectedLessThan || expectedEquals, x <= y); Assert.Equal(expectedGreaterThan || expectedEquals, y <= x); Assert.Equal(expectedGreaterThan || expectedEquals, x >= y); Assert.Equal(expectedLessThan || expectedEquals, y >= x); }
public override int GetHashCode() { // A better hashCode is possible, but this works for now. return(_header.GetHashCode() ^ _chainWork.GetHashCode() ^ (int)_height); }
public static int __hash__(BigInteger self) { #if CLR4 // TODO: we might need our own hash code implementation. This avoids assertion failure. if (self == -2147483648) { return -2147483648; } #endif // check if it's in the Int64 or UInt64 range, and use the built-in hashcode for that instead // this ensures that objects added to dictionaries as (U)Int64 can be looked up with Python longs Int64 i64; if (self.AsInt64(out i64)) { return Int64Ops.__hash__(i64); } else { UInt64 u64; if (self.AsUInt64(out u64)) { return UInt64Ops.__hash__(u64); } } // Call the DLR's BigInteger hash function, which will return an int32 representation of // b if b is within the int32 range. We use that as an optimization for hashing, and // assert the assumption below. int hash = self.GetHashCode(); #if DEBUG int i; if (self.AsInt32(out i)) { Debug.Assert(i == hash, String.Format("hash({0}) == {1}", i, hash)); } #endif return hash; }
int IEcmaValueBinder.GetHashCode(EcmaValueHandle handle) { return(value.GetHashCode()); }