public void TestEquals() { Assert.IsTrue(MySByte1.Equals(MySByte1)); Assert.IsTrue(MySByte1.Equals((SByte)(-42))); Assert.IsTrue(MySByte1.Equals((Int16)(-42)) == false); Assert.IsTrue(MySByte1.Equals(MySByte2) == false); }
public static void TestEquals() { SByte i = 91; Assert.True(i.Equals((SByte)91)); Assert.True(!i.Equals((SByte)0)); }
public static void TestEqualsObject() { SByte i = 78; object obj1 = (SByte)78; Assert.True(i.Equals(obj1)); object obj3 = (SByte)0; Assert.True(!i.Equals(obj3)); }
private static bool VerifySByteImplicitCastToBigInteger(SByte value) { bool ret = true; BigInteger bigInteger; bigInteger = value; ret &= Eval(bigInteger.Equals(value), String.Format("Expected BigInteger {0} to be equal to SByte {1}", bigInteger, value)); ret &= Eval(value.ToString(), bigInteger.ToString(), "SByte.ToString() and BigInteger.ToString()"); ret &= Eval(value, (SByte)bigInteger, "Round tripped SByte"); if (value != SByte.MaxValue) { ret &= Eval((SByte)(value + 1), (SByte)(bigInteger + 1), "BigInteger added to 1"); } if (value != SByte.MinValue) { ret &= Eval((SByte)(value - 1), (SByte)(bigInteger - 1), "BigInteger subtracted by 1"); } ret &= VerifyBigintegerUsingIdentities(bigInteger, 0 == value); return(ret); }
override public Object Get(int record) { SByte value = values[record]; if (!value.Equals(defaultValue)) { return(value); } return(GetBits(record)); }
/// <summary> /// Determines whether the specified <see cref="System.Object" /> is equal to this <see cref="SecsInt8"/> instance. /// </summary> /// <param name="obj">The <see cref="System.Object" /> to compare with this <see cref="SecsInt8"/> instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this <see cref="SecsInt8"/> instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { if (obj == null || !(obj is SecsInt8)) { return(false); } SecsInt8 sobj = obj as SecsInt8; return(_value.Equals(sobj._value)); }
private void MethodTests() { featureTest.FailureMessage = "\tFailed SByte Method Test"; featureTest.Send("SByte Method Test"); SByte value1 = 1; SByte value2 = 2; SByte 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(SByte.Parse("33") == 33); String str = 35.ToString(); featureTest.AssertTrue(str == "35"); SByte parsed; featureTest.AssertTrue(SByte.TryParse(str, out parsed)); featureTest.AssertTrue(parsed == 35); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (!(obj is Item)) { return(false); } Item other = (Item)obj; return((other._sbyte == _sbyte) && _sbyteWrapper.Equals(other._sbyteWrapper )); }
/// <include file='doc\SByteStorage.uex' path='docs/doc[@for="SByteStorage.Compare"]/*' /> /// <internalonly/> override public int Compare(int recordNo1, int recordNo2) { SByte valueNo1 = values[recordNo1]; SByte valueNo2 = values[recordNo2]; if (valueNo1.Equals(defaultValue) || valueNo2.Equals(defaultValue)) { int bitCheck = CompareBits(recordNo1, recordNo2); if (0 != bitCheck) { return(bitCheck); } } return(valueNo1.CompareTo(valueNo2)); }
public Boolean runTest() { int iCountTestcases = 0; int iCountErrors = 0; Console.Error.WriteLine(strName + ": " + strTest + " runTest started..."); SByte[] SByteValues = { (SByte)2, (SByte)(-2), (SByte)0, (SByte)(-0), unchecked ((SByte)0xFF), SByte.MaxValue, SByte.MinValue }; SByte[] SByteCheckValues = { (SByte)2, (SByte)(-2), (SByte)0, (SByte)(-0), unchecked ((SByte)0xFF), SByte.MaxValue, SByte.MinValue }; SByte SByteObj = (SByte)0; SByte SByteCheckObj = (SByte)0; for (int ii = 0; ii < SByteValues.Length; ++ii) { iCountTestcases++; SByteObj = SByteValues[ii]; SByteCheckObj = SByteCheckValues[ii]; if (SByteObj.Equals(SByteCheckObj) != true) { iCountErrors++; print("E_vfr4"); } } if (iCountErrors == 0) { Console.Error.WriteLine("paSs. " + strTest + " iCountTestCases == " + iCountTestcases); return(true); } else { Console.Error.WriteLine("FAiL. " + strTest + " iCountErrors==" + iCountErrors); return(false); } }
public override bool Equals(object obj) { return(val.Equals(obj)); }
public override bool Equals(sbyte x, sbyte y) { return(SByte.Equals(x, y)); }