public void SubtractOneFromZero() { var zero = new Integer256(); var value = zero.Subtract(new Integer256().Add(1)); var result = value.ToBytes(); AreEqual(result, new byte[] { }, true); }
private static void PushDupPop(uint times) { IList<Byte> bytes = new List<byte>(); for (int k = 0; k < times; k++) { bytes.Add((byte)Bytecodes.Push1); bytes.Add((byte)k); } bytes.Add((byte)(Bytecodes.Dup1 + (int)times - 1)); Machine machine = new Machine(); machine.Execute(bytes.ToArray()); Integer256 value = new Integer256(times); Assert.AreEqual(Integer256.Zero, machine.Stack.Pop()); for (int k = 0; k < times; k++) { value = value.Subtract(Integer256.One); Assert.AreEqual(value, machine.Stack.Pop()); } Assert.AreEqual(0, machine.Stack.Size); }
public void SubtractOneFromOne() { var one = new Integer256().Add(1); var value = one.Subtract(one); var result = value.ToBytes(); AreEqual(result, new byte[] { }); }