public void Substraction() { var cint = new CircularInteger(new Interval(-3, 3), 0); Assert.AreEqual(cint.Value, 0); cint--; Assert.AreEqual(cint.Value, -1); cint--; Assert.AreEqual(cint.Value, -2); cint--; Assert.AreEqual(cint.Value, -3); cint--; Assert.AreEqual(cint.Value, 3); cint--; Assert.AreEqual(cint.Value, 2); cint--; Assert.AreEqual(cint.Value, 1); cint--; Assert.AreEqual(cint.Value, 0); cint -= 7; Assert.AreEqual(cint.Value, 0); cint -= 2; Assert.AreEqual(cint.Value, -2); }
public void Addition() { var cint = new CircularInteger(new Interval(-3, 3), 0); Assert.AreEqual(cint.Value, 0); cint++; Assert.AreEqual(cint.Value, 1); cint++; Assert.AreEqual(cint.Value, 2); cint++; Assert.AreEqual(cint.Value, 3); cint++; Assert.AreEqual(cint.Value, -3); cint++; Assert.AreEqual(cint.Value, -2); cint++; Assert.AreEqual(cint.Value, -1); cint++; Assert.AreEqual(cint.Value, 0); cint += 7; Assert.AreEqual(cint.Value, 0); cint += 2; Assert.AreEqual(cint.Value, 2); }