public void SubtractionTest() { CNumber_Integer_Accessor target = new CNumber_Integer_Accessor(); CNumber_Integer other = new CNumber_Integer(0.0); target.FromString("0x5"); other.FromString("0x7"); target.Subtraction(other); Assert.AreEqual("-0x2", target.AsString); target.FromString("0x1.0000.0005"); other.FromString("0x7"); target.Subtraction(other); Assert.AreEqual("0xFFFF.FFFE", target.AsString); target.FromString("0x1.0000.0005"); other.FromString("0x1.0000.0007"); target.Subtraction(other); Assert.AreEqual("-0x2", target.AsString); target.FromString("0x7"); other.FromString("0x1.0000.0005"); target.Subtraction(other); Assert.AreEqual("-0xFFFF.FFFE", target.AsString); target.FromString("0x1.0000.0000.0000.0005"); other.FromString("0x1.0000.0007"); target.Subtraction(other); Assert.AreEqual("0xFFFF.FFFE.FFFF.FFFE", target.AsString); }
public void AdditionTest() { CNumber_Integer_Accessor target = new CNumber_Integer_Accessor(); CNumber_Integer other = new CNumber_Integer(0.0); target.FromString("0x5"); other.FromString("0x7"); target.Addition(other); Assert.AreEqual("0xC", target.AsString); target.FromString("0xFFFFFFFE"); other.FromString("0x7"); target.Addition(other); Assert.AreEqual("0x1.0000.0005", target.AsString); target.FromString("0xFFFFFFFE"); other.FromString("0x100000007"); target.Addition(other); Assert.AreEqual("0x2.0000.0005", target.AsString); target.FromString("0x1FFFFFFFE"); other.FromString("0x100000007"); target.Addition(other); Assert.AreEqual("0x3.0000.0005", target.AsString); target.FromString("0xFFFFFFFFFFFFFFFE"); other.FromString("0x7"); target.Addition(other); Assert.AreEqual("0x1.0000.0000.0000.0005", target.AsString); target.FromString("0x1.FFFF.FFFF.FFFF.FFFE"); other.FromString("0x7"); target.Addition(other); Assert.AreEqual("0x2.0000.0000.0000.0005", target.AsString); target.FromString("0x7"); other.FromString("0x1.FFFF.FFFF.FFFF.FFFE"); target.Addition(other); Assert.AreEqual("0x2.0000.0000.0000.0005", target.AsString); target.FromString("0x1.FFFF.FFFF.FFFF.FFFE"); other.FromString("0x1.0000.0007"); target.Addition(other); Assert.AreEqual("0x2.0000.0001.0000.0005", target.AsString); target.FromString("0x1.FFFF.FFFE.FFFF.FFFE"); other.FromString("0x1.0000.0007"); target.Addition(other); Assert.AreEqual("0x2.0000.0000.0000.0005", target.AsString); }