Beispiel #1
0
        public override int GetHashCode()
        {
            var hashCode = -783812246;

            hashCode = hashCode * -1521134295 + base.GetHashCode();
            hashCode = hashCode * -1521134295 + Value.GetHashCode();
            return(hashCode);
        }
        public void TestEquality()
        {
            BigDecimal a = new BigDecimal(14121976);
            BigDecimal b = new BigDecimal(141219760000, 4);

            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
            Assert.AreEqual(a, b);

            a = new BigDecimal(14121976, 4);
            b = new BigDecimal(1412.1976m);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
            Assert.AreEqual(a, b);

            a = new BigDecimal(-14121976, 4);
            b = new BigDecimal(-1412.1976m);
            Assert.AreEqual(a.GetHashCode(), b.GetHashCode());
            Assert.AreEqual(a, b);
        }
Beispiel #3
0
 public static int Hash(BigDecimal/*!*/ self) {
     return self.GetHashCode();
 }
Beispiel #4
0
 public override int GetHashCode()
 {
     return(_value.GetHashCode());
 }
Beispiel #5
0
 public static int Hash(BigDecimal /*!*/ self)
 {
     return(self.GetHashCode());
 }
Beispiel #6
0
 /// <summary>
 /// Returns a hashcode.
 /// </summary>
 /// <returns>An integer value representing the hashcode.</returns>
 public override int GetHashCode()
 {
     // ReSharper disable once NonReadonlyMemberInGetHashCode
     return(Backing.GetHashCode());
 }
Beispiel #7
0
 public override int GetHashCode()
 {
     return(innerValue.GetHashCode() ^ State.GetHashCode());
 }
Beispiel #8
0
 public override int GetHashCode()
 {
     return(Val.GetHashCode());
 }
Beispiel #9
0
 public override int GetHashCode()
 {
     return(bigDecimal.GetHashCode() ^ numberState.GetHashCode());
 }
Beispiel #10
0
 public void TestGetHashCode()
 {
     // anything that is equal must have the same hashCode
     BigDecimal hash = BigDecimal.Parse("1.00");
     BigDecimal hash2 = new BigDecimal(1.00D);
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "the hashCode of 1.00 and 1.00D is equal");
     hash2 = BigDecimal.Parse("1.0");
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "the hashCode of 1.0 and 1.00 is equal");
     BigInteger val = BigInteger.Parse("100");
     hash2 = new BigDecimal(val, 2);
     Assert.IsTrue(hash.GetHashCode() == hash2.GetHashCode() && hash.Equals(hash2),
                   "hashCode of 1.00 and 1.00(bigInteger) is not equal");
     hash = new BigDecimal(value, 2);
     hash2 = BigDecimal.Parse("-1233456.0000");
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "hashCode of 123459.08 and -1233456.0000 is not equal");
     hash2 = new BigDecimal(value.Negate(), 2);
     Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2),
                   "hashCode of 123459.08 and -123459.08 is not equal");
 }