Example #1
0
    public static void TestEquals()
    {
        UInt32 i = 911;

        Assert.True(i.Equals((UInt32)911));
        Assert.True(!i.Equals((UInt32)0));
    }
Example #2
0
 public void TestEquals()
 {
     Assert.IsTrue(MyUInt32_1.Equals(MyUInt32_1));
     Assert.IsTrue(MyUInt32_1.Equals((object)(UInt32)(42)));
     Assert.IsTrue(MyUInt32_1.Equals((object)(SByte)(42)) == false);
     Assert.IsTrue(MyUInt32_1.Equals(MyUInt32_2) == false);
 }
Example #3
0
    public override bool Equals(object obj)
    {
        if (obj is CanObjectId)
        {
            return(_Value.Equals((obj as CanObjectId)._Value));
        }

        return(_Value.Equals(obj));
    }
Example #4
0
    public static void TestEqualsObject()
    {
        UInt32 i = 789;

        object obj1 = (UInt32)789;

        Assert.True(i.Equals(obj1));

        object obj3 = (UInt32)0;

        Assert.True(!i.Equals(obj3));
    }
 /// <summary>
 /// Compare class value against the object argument. Supported argument types are
 /// <see cref="UInteger32"/> and Int32.
 /// </summary>
 /// <param name="obj">Object to compare values with</param>
 /// <returns>True if object value is the same as this class, otherwise false.</returns>
 public override bool Equals(object obj)
 {
     if (obj is UInteger32)
     {
         UInteger32 u32 = (UInteger32)obj;
         return(_value.Equals(u32.Value));
     }
     else if (obj is UInt32)
     {
         UInt32 u32 = (UInt32)obj;
         return(_value.Equals(u32));
     }
     return(false);            // last resort
 }
Example #6
0
    public static void Main()
    {
        try
        {
// <Snippet1>
            UInt32 myVariable1 = 20;
            UInt32 myVariable2 = 20;

            // Display the declaring type.
            Console.WriteLine("\nType of 'myVariable1' is '{0}' and" +
                              " value is :{1}", myVariable1.GetType(), myVariable1);
            Console.WriteLine("Type of 'myVariable2' is '{0}' and" +
                              " value is :{1}", myVariable2.GetType(), myVariable2);

            // Compare 'myVariable1' instance with 'myVariable2' Object.
            if (myVariable1.Equals(myVariable2))
            {
                Console.WriteLine("\nStructures 'myVariable1' and " +
                                  "'myVariable2' are equal");
            }
            else
            {
                Console.WriteLine("\nStructures 'myVariable1' and " +
                                  "'myVariable2' are not equal");
            }
// </Snippet1>
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception :{0}", e.Message);
        }
    }
Example #7
0
    public bool PosTest4()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest4: object and the instance have the same type but different value");
        try
        {
            int    intA     = this.GetInt32(0, Int32.MaxValue);
            UInt32 uintA    = (UInt32)intA;
            UInt32 comValue = (UInt32)(intA + 1);
            ActualResult = uintA.Equals(comValue);
            if (ActualResult)
            {
                TestLibrary.TestFramework.LogError("007", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #8
0
            public bool Equals(Mesh other)
            {
                if (other == null)
                {
                    return(false);
                }

                return(mName.Equals(other.mName) &&
                       mMaterialIndex.Equals(other.mMaterialIndex) &&
                       mVertexFormatIndex.Equals(other.mVertexFormatIndex) &&
                       mVertexBufferIndex.Equals(other.mVertexBufferIndex) &&
                       mIndexBufferIndex.Equals(other.mIndexBufferIndex) &&
                       mPrimitiveType.Equals(other.mPrimitiveType) &&
                       mFlags.Equals(other.mFlags) &&
                       mStreamOffset.Equals(other.mStreamOffset) &&
                       mStartVertex.Equals(other.mStartVertex) &&
                       mStartIndex.Equals(other.mStartIndex) &&
                       mMinVertexIndex.Equals(other.mMinVertexIndex) &&
                       mVertexCount.Equals(other.mVertexCount) &&
                       mPrimitiveCount.Equals(other.mPrimitiveCount) &&
                       mSkinControllerIndex.Equals(other.mSkinControllerIndex) &&
                       mScaleOffsetIndex.Equals(other.mScaleOffsetIndex) &&
                       mJointReferences.Equals(other.mJointReferences) &&
                       mBounds.Equals(other.mBounds) &&
                       mGeometryStates.Equals(other.mGeometryStates) &&
                       mParentName.Equals(other.mParentName) &&
                       mMirrorPlane.Equals(other.mMirrorPlane) &&
                       mOwner.Equals(other.mOwner)
                       );
            }
Example #9
0
        private static bool VerifyUInt32ImplicitCastToBigInteger(UInt32 value)
        {
            bool       ret = true;
            BigInteger bigInteger;

            bigInteger = value;

            ret &= Eval(bigInteger.Equals(value), String.Format("Expected BigInteger {0} to be equal to UInt32 {1}", bigInteger, value));
            ret &= Eval(value.ToString(), bigInteger.ToString(), "UInt32.ToString() and BigInteger.ToString()");
            ret &= Eval(value, (UInt32)bigInteger, "Round tripped UInt32");

            if (value != UInt32.MaxValue)
            {
                ret &= Eval((UInt32)(value + 1), (UInt32)(bigInteger + 1), "BigInteger added to 1");
            }

            if (value != UInt32.MinValue)
            {
                ret &= Eval((UInt32)(value - 1), (UInt32)(bigInteger - 1), "BigInteger subtracted by 1");
            }

            ret &= VerifyBigintegerUsingIdentities(bigInteger, 0 == value);

            return(ret);
        }
Example #10
0
    public bool PosTest3()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest3: UInt32 value is different from the instance 2");
        try
        {
            int    intA     = this.GetInt32(0, Int32.MaxValue);
            UInt32 uintA    = (UInt32)(intA + 1);
            UInt32 comValue = (UInt32)intA;
            ActualResult = uintA.Equals(comValue);
            if (ActualResult)
            {
                TestLibrary.TestFramework.LogError("005", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #11
0
        /// <summary>
        /// Compare class value against the object argument. Supported argument types are
        /// <see cref="UInteger32"/> and Int32.
        /// </summary>
        /// <param name="obj">Object to compare values with</param>
        /// <returns>True if object value is the same as this class, otherwise false.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj is UInteger32 uinteger32)
            {
                return(_value.Equals(uinteger32.Value));
            }
            else if (obj is UInt32 u32)
            {
                return(_value.Equals(u32));
            }
            return(false); // last resort
        }
Example #12
0
 public bool Equals(Unit other)
 {
     if (other == null)
     {
         return(false);
     }
     return(ID.Equals(other.ID));
 }
Example #13
0
 public bool Equals(SegmentInfo other)
 {
     return
         (mVertexSize.Equals(other.mVertexSize) &&
          mVertexCount.Equals(other.mVertexCount) &&
          mByteOffset.Equals(other.mByteOffset) &&
          mSwizzles.Equals(other.mSwizzles)
         );
 }
Example #14
0
 public bool Equals(GeometryState other)
 {
     return
         (mName.Equals(other.mName) &&
          mStartIndex.Equals(other.mStartIndex) &&
          mMinVertexIndex.Equals(other.mMinVertexIndex) &&
          mVertexCount.Equals(other.mVertexCount) &&
          mPrimitiveCount.Equals(other.mPrimitiveCount)
         );
 }
        override public Object Get(int record)
        {
            UInt32 value = values[record];

            if (!value.Equals(defaultValue))
            {
                return(value);
            }
            return(GetBits(record));
        }
Example #16
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" /> is equal to this <see cref="SecsUInt32"/> instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this <see cref="SecsUInt32"/> instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this <see cref="SecsUInt32"/> instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is SecsUInt32))
            {
                return(false);
            }

            SecsUInt32 sobj = obj as SecsUInt32;

            return(_value.Equals(sobj._value));
        }
Example #17
0
        /// <summary>
        /// Reads supported exposure time values from Parameter.Device and populates
        /// ArrayParameter.Options accordingly. Sets the SelectedOption as well.
        ///
        /// Exposure time auto value is set by setting the value in PhotoCaptureDevice API to
        /// null, therefore the separate handling for option "Auto".
        /// </summary>
        protected override void PopulateOptions()
        {
            ArrayParameterOption option         = new ArrayParameterOption(null, "Auto", "Assets/Icons/overlay.exposuretime.auto.png");
            ArrayParameterOption selectedOption = option;

            Options.Add(option);

            CameraCapturePropertyRange range = PhotoCaptureDevice.GetSupportedPropertyRange(Device.SensorLocation, KnownCameraPhotoProperties.ExposureTime);
            object value = Device.GetProperty(PropertyId);

            // UInt32[] standardValues = { /* 16000, 8000, 4000,*/ 2000, 1000, 500, 250, 125, 60, 30, 15, 8, 4, 2 };
            UInt32[] standardValues = { 16666, 16000, 8000, 4000, 2000, 1000, 500, 250, 125, 60, 30, 15, 8, 4, 2 };

            UInt32 min = (UInt32)range.Min;
            UInt32 max = (UInt32)range.Max;

            System.Diagnostics.Debug.WriteLine(String.Format("Exposure time range (min {0}, max {1})", min, max));

            foreach (UInt32 i in standardValues)
            {
                UInt32 usecs = 1000000 / i;

                if (usecs >= min && usecs <= max)
                {
                    option = new ArrayParameterOption(usecs, "1 / " + i.ToString() + " s", "Assets/Icons/overlay.exposuretime." + i.ToString() + ".png");

                    Options.Add(option);

                    if (selectedOption == null && usecs.Equals(value))
                    {
                        selectedOption = option;
                    }
                }
            }

            // Expsoure times of 1 second and over are possible in some devices.
            UInt32 microseconds = 1000000; // second in microseconds

            while (microseconds <= max)
            {
                UInt32 usecs = microseconds / 1000000;
                option = new ArrayParameterOption(microseconds, usecs.ToString() + " s", "Assets/Icons/overlay.exposuretime." + usecs.ToString() + "s.png");

                Options.Add(option);

                if (selectedOption == null && usecs.Equals(value))
                {
                    selectedOption = option;
                }
                microseconds *= 2;
            }

            SelectedOption = selectedOption;
        }
Example #18
0
 private void DecodeInputValues()
 {
     if (magicHeader.Equals(Commands.reverseMagic))
     {
         minimumAir0           = received[6];
         standAloneMinimumAir0 = received[8];
         minimumValid0         = received[10];
         minimumAir1           = received[7];
         standAloneMinimumAir1 = received[9];
         minimumValid1         = received[11];
     }
 }
Example #19
0
        private void MethodTests()
        {
            featureTest.FailureMessage = "\tFailed UInt32 Method Test";
            featureTest.Send("UInt32 Method Test");
            UInt32 value1 = 1;
            UInt32 value2 = 2;
            UInt32 value3 = 3;
            Object obj1   = value1;
            Object obj2   = value2;
            Object obj3   = value3;

            featureTest.AssertTrue(value2.CompareTo(value1) > 0);
            featureTest.AssertTrue(value2.CompareTo(value3) < 0);
            featureTest.AssertTrue(value2.CompareTo(value2) == 0);

            featureTest.AssertTrue(value2.CompareTo(obj1) > 0);
            featureTest.AssertTrue(value2.CompareTo(obj3) < 0);
            featureTest.AssertTrue(value2.CompareTo(obj2) == 0);

            featureTest.AssertTrue(!value2.Equals(value1));
            featureTest.AssertTrue(!value2.Equals(value3));
            featureTest.AssertTrue(value2.Equals(value2));

            featureTest.AssertTrue(!value2.Equals(obj1));
            featureTest.AssertTrue(!value2.Equals(obj3));
            featureTest.AssertTrue(value2.Equals(obj2));
            featureTest.AssertTrue(UInt32.Parse("33") == 33);
            String str = 35.ToString();

            featureTest.AssertTrue(str == "35");
            UInt32 parsed;

            featureTest.AssertTrue(UInt32.TryParse(str, out parsed));
            featureTest.AssertTrue(parsed == 35);
        }
Example #20
0
            public override bool Equals(object obj)
            {
                if (obj == this)
                {
                    return(true);
                }
                if (!(obj is Item))
                {
                    return(false);
                }
                Item other = (Item)obj;

                return((other._uint == _uint) && _uintWrapper.Equals(other._uintWrapper));
            }
Example #21
0
        public async void UpdateDataRelayStatus()
        {
            updatingStatus = true;
            request_sucess = false;
            await RequestRelayStatus();

            if (request_sucess)
            {
                read_request_success = false;
                await ReadCompressorData();

                if (read_request_success)
                {
                    if (magicHeader.Equals(Commands.reverseMagic))
                    {
                        await UpdateViewCompressorStatus();
                    }
                }
            }


            updatingStatus = false;
        }
Example #22
0
        private void UpdateFansView()
        {
            int k;

            if (magicHeader.Equals(Commands.reverseMagic))
            {
                getting_updated = true;
                for (int i = 0; i < NUMBER_OF_FANS; i++)
                {
                    listOfToggles[i].IsEnabled = false;
                    listOfDials[i].Value       = received[10 + i] * 14000 / 255;
                    lastPWMValue[i]            = received[10 + i];
                    k = ((1 + i) % 3);
                    if (((received[6] & 0x07) & (0x01 << k)) > 0)
                    {
                        if (listOfToggles[i].IsOn)
                        {
                            listOfToggles[i].IsOn = false;
                        }

                        listOfDials[i].Opacity = 0.4;
                    }
                    else
                    {
                        if (listOfToggles[i].IsOn)
                        {
                        }
                        else
                        {
                            listOfToggles[i].IsOn = true;
                        }

                        listOfDials[i].Opacity = 1;
                    }
                    if (i < 2)
                    {
                        Set_fault_mode(received[7], i);
                    }
                    else
                    {
                        Set_fault_mode(received[6], i - 1);
                    }
                    listOfToggles[i].IsEnabled = true;
                }

                getting_updated = false;
            }
        }
Example #23
0
 private void FillFloatArray()
 {
     if (magicHeader.Equals(Commands.reverseMagic))
     {
         for (int i = 0; i < 3; i++)
         {
             for (int j = 0; j < 4; j++)
             {
                 System.Buffer.BlockCopy(received, 7 + 4 * ((4 * i) + (j)), floatArray, 0, 4);
                 lastValue    = temperatureValues[i, j];
                 currentValue = BitConverter.ToSingle(floatArray, 0);
                 if (lastValue != currentValue)
                 {
                     temperatureValues[i, j] = currentValue;
                     UpdateValueText(i, j);
                 }
             }
         }
     }
 }
Example #24
0
            public UInt32 GetAge(UInt32 year)
            {
                UInt32 noOfDays          = 0;
                UInt32 CurrentYear       = (UInt32)DateTime.Now.Year;
                UInt32 birthYear         = (UInt32)year;
                UInt32 numberOfLeapYears = 0;
                UInt32 years;

                while (UInt32.Equals(birthYear, CurrentYear))
                {
                    if (Array.BinarySearch(m_leapYear, m_DateOfBirth.Year) > 0)
                    {
                        numberOfLeapYears++;
                    }
                    noOfDays += 365;
                    birthYear++;
                }
                years = (noOfDays + (numberOfLeapYears * 366)) - numberOfLeapYears / 365;
                return(years);
            }
Example #25
0
    public bool PosTest4()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest4: UInt32 value is equal the instance ");
        try
        {
            UInt32 uintA    = 0xffffffff;
            UInt32 comValue = UInt32.MaxValue;
            ActualResult = uintA.Equals(comValue);
            if (!ActualResult)
            {
                TestLibrary.TestFramework.LogError("007", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("008", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #26
0
    public bool PosTest1()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest1: object value is null");
        try
        {
            UInt32 uintA    = (UInt32)this.GetInt32(0, Int32.MaxValue);
            object comValue = null;
            ActualResult = uintA.Equals(comValue);
            if (ActualResult)
            {
                TestLibrary.TestFramework.LogError("001", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #27
0
    public bool PosTest6()
    {
        bool retVal = true;
        bool ActualResult;

        TestLibrary.TestFramework.BeginScenario("PosTest6: object and the instance have the same type and the same value 2");
        try
        {
            UInt32 uintA    = 0;
            UInt32 comValue = UInt32.MinValue;
            ActualResult = uintA.Equals(comValue);
            if (!ActualResult)
            {
                TestLibrary.TestFramework.LogError("011", "the ActualResult is not the ExpectResult");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("012", "Unexpect exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Example #28
0
 public static bool operator ==(NetworkId a, NetworkId b)
 {
     return(a.Equals(b));
 }
Example #29
0
 public bool Equals(Bone other)
 {
     return(mNameHash.Equals(other.mNameHash) &&
            mInverseBindPose.Equals(other.mInverseBindPose));
 }
Example #30
0
        private void button3_Click(object sender, EventArgs e)
        {
            // Update
            Core.Output("Updating results, showing only ones with new value...");
            string val  = textBox1.Text;
            string type = comboBox1.Text;

            if (type == "Int16")
            {
            }
            else if (type == "Int32")
            {
                Int32         value = Int32.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, Int32> > data    = (List <Tuple <IntPtr, Int32> >)s.DataSource;
                List <Tuple <IntPtr, Int32> > newdata = new List <Tuple <IntPtr, Int32> >();
                foreach (Tuple <IntPtr, Int32> t in data)
                {
                    Int32 nval = MM.ReadInt32(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, Int32>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "UInt32")
            {
                UInt32        value = UInt32.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, UInt32> > data    = (List <Tuple <IntPtr, UInt32> >)s.DataSource;
                List <Tuple <IntPtr, UInt32> > newdata = new List <Tuple <IntPtr, UInt32> >();
                foreach (Tuple <IntPtr, UInt32> t in data)
                {
                    UInt32 nval = MM.ReadUInt32(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, UInt32>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "Int64")
            {
                Int64         value = Int64.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, Int64> > data    = (List <Tuple <IntPtr, Int64> >)s.DataSource;
                List <Tuple <IntPtr, Int64> > newdata = new List <Tuple <IntPtr, Int64> >();
                foreach (Tuple <IntPtr, Int64> t in data)
                {
                    Int64 nval = MM.ReadInt64(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, Int64>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "UInt64")
            {
                UInt64        value = UInt64.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, UInt64> > data    = (List <Tuple <IntPtr, UInt64> >)s.DataSource;
                List <Tuple <IntPtr, UInt64> > newdata = new List <Tuple <IntPtr, UInt64> >();
                foreach (Tuple <IntPtr, UInt64> t in data)
                {
                    UInt64 nval = MM.ReadUInt64(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, UInt64>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "Float")
            {
                float         value = float.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, float> > data    = (List <Tuple <IntPtr, float> >)s.DataSource;
                List <Tuple <IntPtr, float> > newdata = new List <Tuple <IntPtr, float> >();
                foreach (Tuple <IntPtr, float> t in data)
                {
                    float nval = MM.ReadFloat(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, float>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
            else if (type == "Double")
            {
                double        value = double.Parse(val);
                BindingSource s     = (BindingSource)dataGridView1.DataSource;
                List <Tuple <IntPtr, double> > data    = (List <Tuple <IntPtr, double> >)s.DataSource;
                List <Tuple <IntPtr, double> > newdata = new List <Tuple <IntPtr, double> >();
                foreach (Tuple <IntPtr, double> t in data)
                {
                    double nval = MM.ReadDouble(t.Item1);
                    if (nval.Equals(value))
                    {
                        newdata.Add(new Tuple <IntPtr, double>(t.Item1, nval));
                    }
                }
                s.DataSource             = newdata;
                dataGridView1.DataSource = s;
            }
        }