public virtual bool runTest()
    {
        int iCountTestcases = 0;
        int iCountErrors    = 0;

        Console.Error.WriteLine(strName + ": " + strTest + " runTest started...");
        Boolean boolX = false;
        Boolean boolY = false;

        do
        {
            iCountTestcases++;
            boolX = true;
            boolY = boolX;
            if (boolX.Equals(boolY) != true)
            {
                iCountErrors++; print("E_bdu1");
            }
            if (boolX.GetHashCode() != boolY.GetHashCode())
            {
                iCountErrors++; print("E_ik4");
            }
            iCountTestcases++;
            boolX = true;
            boolY = false;
            if (boolX.Equals(boolY) != false)
            {
                iCountErrors++; print("E_j58");
            }
            if (boolX.GetHashCode() == boolY.GetHashCode())
            {
                iCountErrors++; print("E_he8");
            }
            iCountTestcases++;
            if ((boolX.GetHashCode() != 1) || (boolY.GetHashCode() != 0))
            {
                iCountErrors++; print("E_dh2");
            }
        }while (false);
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine("paSs. " + strTest + "   iCountTestCases == " + iCountTestcases);
            return(true);
        }
        else
        {
            Console.Error.WriteLine(" FAiL : " + strTest + "    iCountErrors==" + iCountErrors);
            return(false);
        }
    }
Exemple #2
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = (int)Type;

                if (Type == JsonValueType.String)
                {
                    hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
                }
                else if (Type == JsonValueType.Number)
                {
                    hashCode = (hashCode * 397) ^ Number.GetHashCode();
                }
                else if (Type == JsonValueType.Boolean)
                {
                    hashCode = (hashCode * 397) ^ Boolean.GetHashCode();
                }
                else if (Type == JsonValueType.Object)
                {
                    hashCode = (hashCode * 397) ^ Object.GetHashCode();
                }
                else if (Type == JsonValueType.Array)
                {
                    hashCode = (hashCode * 397) ^ Array.GetHashCode();
                }

                return(hashCode);
            }
        }
Exemple #3
0
        /// <summary>
        /// Serves as a hash function for a particular type.
        /// </summary>
        /// <returns>
        /// A hash code for the current <see cref="T:System.Object"/>.
        /// </returns>
        public override int GetHashCode()
        {
            switch (Type)
            {
            case JsonValueType.Number:
                return(Number.GetHashCode());

            case JsonValueType.String:
                return(String.GetHashCode());

            case JsonValueType.Boolean:
                return(Boolean.GetHashCode());

            case JsonValueType.Object:
                return(Object.GetHashCode());

            case JsonValueType.Array:
                return(Array.GetHashCode());

            case JsonValueType.Null:
                return(JsonValueType.Null.GetHashCode());
            }
            // ReSharper disable once BaseObjectGetHashCodeCallInGetHashCode
            return(base.GetHashCode());
        }
        public void TestGetHashCode()
        {
            Boolean t = true, f = false;

            Assert.AreEqual(1, t.GetHashCode(), "GetHashCode True failed");
            Assert.AreEqual(0, f.GetHashCode(), "GetHashCode True failed");
        }
Exemple #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Sbyte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ Boolean.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ (Exception != null ? Exception.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Enum;
         hashCode = (hashCode * 397) ^ Struct.GetHashCode();
         return(hashCode);
     }
 }
Exemple #6
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 13;
                hash = (hash * 397) ^ Type.GetHashCode();

                switch (Type)
                {
                case VariableType.Boolean: hash = (hash * 397) ^ Boolean.GetHashCode(); break;

                case VariableType.Integer: hash = (hash * 397) ^ Integer.GetHashCode(); break;

                case VariableType.Number: hash = (hash * 397) ^ Number.GetHashCode(); break;

                case VariableType.String: hash = (hash * 397) ^ String.GetHashCode(); break;

                case VariableType.Object: hash = (hash * 397) ^ ComponentHelper.GetAsBaseObject(Object).GetHashCode(); break;

                case VariableType.Store: hash = (hash * 397) ^ Store.GetHashCode(); break;
                }

                return(hash);
            }
        }
Exemple #7
0
        /// <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());
        }
Exemple #8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Topic.Length != 0)
            {
                hash ^= Topic.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Number)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Number);
            }
            if (typeCase_ == TypeOneofCase.Boolean)
            {
                hash ^= Boolean.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.String)
            {
                hash ^= String.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Vector2)
            {
                hash ^= Vector2.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Vector3)
            {
                hash ^= Vector3.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Vector4)
            {
                hash ^= Vector4.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Quaternion)
            {
                hash ^= Quaternion.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Matrix3X2)
            {
                hash ^= Matrix3X2.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Matrix4X4)
            {
                hash ^= Matrix4X4.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Color)
            {
                hash ^= Color.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
            public override int GetHashCode()
            {
                int hash = 17;

                hash += 23 * Ascii.GetHashCode();
                hash += 23 * Integer.GetHashCode();
                hash += 23 * Boolean.GetHashCode();
                hash += 23 * Unicode.GetHashCode();
                hash += 23 * Single.GetHashCode();

                return(hash);
            }
Exemple #10
0
        public override Int32 GetHashCode()
        {
            var hashCode = instructionPointer.GetHashCode() ^
                           registers.GetHashCode() ^
                           zeroFlag.GetHashCode();

            foreach (var key in dataSegment.Keys)
            {
                hashCode ^= dataSegment[key].GetHashCode();
            }

            return(hashCode);
        }
Exemple #11
0
        /// <summary> Gets the hash code for the current format. </summary>
        /// <returns> The hash code. </returns>
        public override Int32 GetHashCode()
        {
            Int32 Hash = FConnectionId.GetHashCode();

            Hash = (Hash * 397) ^ FDeviceType.GetHashCode();
            Hash = (Hash * 397) ^ FInterval.GetHashCode();
            Hash = (Hash * 397) ^ FMode.GetHashCode();
            Hash = (Hash * 397) ^ FNotificationsEnabled.GetHashCode();
            Hash = (Hash * 397) ^ FNumberOfBytes.GetHashCode();
            Hash = (Hash * 397) ^ FRevision.GetHashCode();
            Hash = (Hash * 397) ^ FUnit.GetHashCode();
            return(Hash);
        }
Exemple #12
0
        public override int GetHashCode()
        {
            switch (_type)
            {
            case TokenType.Boolean:
                return(Boolean.GetHashCode());

            case TokenType.Number:
                return(Int.GetHashCode());

            case TokenType.String:
                return(String.GetHashCode());
            }
            return((int)_type);
        }
Exemple #13
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = DataType.GetHashCode();
         result = (result * 397) ^ Time.GetHashCode();
         result = (result * 397) ^ Boolean.GetHashCode();
         result = (result * 397) ^ Integer;
         result = (result * 397) ^ Date.GetHashCode();
         result = (result * 397) ^ Real.GetHashCode();
         result = (result * 397) ^ String.GetHashCode();
         result = (result * 397) ^ Nd;
         result = (result * 397) ^ Error.GetHashCode();
         return(result);
     }
 }
Exemple #14
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Boolean.GetHashCode();
         result = (result * 397) ^ Byte.GetHashCode();
         result = (result * 397) ^ Char.GetHashCode();
         result = (result * 397) ^ DateTime.GetHashCode();
         result = (result * 397) ^ DateTimeOffset.GetHashCode();
         result = (result * 397) ^ Decimal.GetHashCode();
         result = (result * 397) ^ Double.GetHashCode();
         result = (result * 397) ^ Float.GetHashCode();
         result = (result * 397) ^ Int;
         result = (result * 397) ^ Guid.GetHashCode();
         result = (result * 397) ^ Long.GetHashCode();
         result = (result * 397) ^ (String != null ? String.GetHashCode() : 0);
         result = (result * 397) ^ TimeSpan.GetHashCode();
         result = (result * 397) ^ (Uri != null ? Uri.GetHashCode() : 0);
         return(result);
     }
 }
Exemple #15
0
 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);
     }
 }
Exemple #16
0
 public override int GetHashCode() => value.GetHashCode();
Exemple #17
0
 public override Int32 GetHashCode()
 {
     return(_data.GetHashCode() ^ _exp.GetHashCode() ^ _sign.GetHashCode());
 }
Exemple #18
0
 public override Int32 GetHashCode()
 {
     return(InstructionPointer.GetHashCode() ^ IsTainted.GetHashCode());
 }
Exemple #19
0
 public CommandElement(CommandDirection direction, CommandButton button, Int32?triggertime, Boolean helddown, Boolean nothingelse)
 {
     Direction        = direction;
     Buttons          = button;
     TriggerOnRelease = triggertime;
     HeldDown         = helddown;
     NothingElse      = nothingelse;
     Hash             = Direction.GetHashCode() ^ Buttons.GetHashCode() ^ TriggerOnRelease.GetValueOrDefault(0).GetHashCode() ^ HeldDown.GetHashCode() ^ NothingElse.GetHashCode();
     MatchHash1       = BuildHash1();
     MatchHash2       = BuildHash2();
 }
Exemple #20
0
 public override Int32 GetHashCode()
 {
     return(Value.GetHashCode() ^ ZeroFlag.GetHashCode());
 }
 public override int GetHashCode()
 {
     return(76137213 ^ _clearCalled.GetHashCode());
 }
Exemple #22
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(_value.GetHashCode());
 }
Exemple #23
0
    public bool runTest()
    {
        Console.Error.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
        int    iCountErrors    = 0;
        int    iCountTestcases = 0;
        String strLoc          = "Loc_000oo";

        short[]   in2Arr = new Int16[10];
        int[]     in4Arr = new Int32[5];
        Boolean[] boArr = new Boolean[3];
        int       iHashCode1, iHashCode2;

        try {
            do
            {
                strLoc = "Loc_01hc";
                iCountTestcases++;
                in2Arr     = new Int16[10];
                iHashCode1 = in2Arr.GetHashCode();
                iHashCode2 = in2Arr.GetHashCode();
                if (iHashCode1 != iHashCode2)
                {
                    iCountErrors++;
                    Console.WriteLine(s_strTFAbbrev + ", Err_01hc! , Array.GetHashCode on a same instance twice result different value.");
                }
                strLoc = "Loc_02hc";
                iCountTestcases++;
                in4Arr     = new Int32[5];
                iHashCode1 = in2Arr.GetHashCode();
                iHashCode2 = in4Arr.GetHashCode();
                if (iHashCode1 == iHashCode2)
                {
                    iCountErrors++;
                    Console.WriteLine(s_strTFAbbrev + ", Err_02hc! , Array.GetHashCode on a different array type instances result same value.");
                }
                boArr  = new Boolean[3];
                strLoc = "Loc_03hc";
                iCountTestcases++;
                iHashCode1 = in2Arr.GetHashCode();
                iHashCode2 = boArr.GetHashCode();
                if (iHashCode1 == iHashCode2)
                {
                    iCountErrors++;
                    Console.WriteLine(s_strTFAbbrev + ", Err_03hc! , Array.GetHashCode on a different array type instances result same value.");
                }
                strLoc = "Loc_04hc";
                iCountTestcases++;
                Array Arr1 = Array.CreateInstance(typeof(double), 10);
                Array Arr2 = Array.CreateInstance(typeof(Single), 0);
                iHashCode1 = Arr1.GetHashCode();
                iHashCode2 = Arr2.GetHashCode();
                if (iHashCode1 == iHashCode2)
                {
                    iCountErrors++;
                    Console.WriteLine(s_strTFAbbrev + ", Err_04hc! , Array.GetHashCode on a different array type instances result same value.");
                }
                int[][] i4Arr = new int[3][];
                i4Arr[0] = new int[] { 1, 2, 3 };
                i4Arr[1] = new int[] { 1, 2, 3, 4, 5, 6 };
                i4Arr[2] = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
                strLoc   = "Loc_05hc";
                iCountTestcases++;
                iHashCode1 = i4Arr.GetHashCode();
                iHashCode2 = i4Arr.GetHashCode();
                if (iHashCode1 != iHashCode2)
                {
                    iCountErrors++;
                    Console.WriteLine(s_strTFAbbrev + ", Err_05hc! , Array.GetHashCode on a same instance of jagged array should result same value.");
                }
                strLoc = "Loc_06hc";
                iCountTestcases++;
                string[,,,,,] strArr = new string[6, 5, 4, 3, 2, 1];
                iHashCode2           = strArr.GetHashCode();
                if (iHashCode1 == iHashCode2)
                {
                    iCountErrors++;
                    Console.WriteLine(s_strTFAbbrev + ", Err_06hc! , Array.GetHashCode on a different array type instances result same value.");
                }
            } while (false);
        } catch (Exception exc_general) {
            ++iCountErrors;
            Console.WriteLine(s_strTFAbbrev + ", Error Err_8888yyy!  strLoc==" + strLoc + ", exc_general==" + exc_general);
        }
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine("paSs.   " + s_strTFPath + " " + s_strTFName + " ,iCountTestcases==" + iCountTestcases);
            return(true);
        }
        else
        {
            Console.Error.WriteLine("FAiL!   " + s_strTFPath + " " + s_strTFName + " ,inCountErrors==" + iCountErrors + " , BugNums?: " + s_strActiveBugNums);
            return(false);
        }
    }
Exemple #24
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>
 /// A 32-bit signed integer hash code.
 /// </returns>
 public override int GetHashCode() => Ratio.GetHashCode() ^ Boolean.GetHashCode();
 /// <summary>
 /// Gets the hash code.
 /// </summary>
 public override Int32 GetHashCode()
 {
     return(_name.GetHashCode() + _required.GetHashCode());
 }
Exemple #26
0
 /// <summary>
 /// Serves as a hash function for a particular type
 /// </summary>
 /// <returns>A hash code for the current <see cref="Bit"/></returns>
 public override Int32 GetHashCode()
 {
     return(value.GetHashCode());
 }