public void TestDigitAndZeroClasses() { var dig = new Digit(3); Assert.AreEqual(true, dig.isDigit()); Assert.AreEqual(3, dig.digit); var zero = new FunctionZero(); Assert.AreEqual(true, zero.isDigit()); Assert.AreEqual(0, zero.digit); }
public void TestFunctionK() { var zero = new FunctionZero(); var one = new FunctionSucc().exec(zero); var two = new FunctionDbl().exec(one); var four = new FunctionDbl().exec(two); var Kpart = new FunctionK().exec(four); Assert.AreEqual(false, Kpart.isDigit()); var final = Kpart.exec(two); Assert.AreEqual(true, final.isDigit()); Assert.AreEqual(4, (final as Digit).digit); }
public void TestFunctionS() { var eng = new Engine.BaseTypes.Engine(0); var cell = eng.getPlayerCells()[2]; cell.setValue(new FunctionDbl()); var zero = new FunctionZero(); var one = new FunctionSucc().exec(zero); var two = new FunctionDbl().exec(one); var g = new FunctionDbl(); var f = new FunctionGet(); var part1 = new FunctionS().exec(f); var part2 = part1.exec(g); var res = part2.exec(two); Assert.AreEqual(true, res.isDigit()); Assert.AreEqual(8, (res as Digit).digit); }
public void TestFunctionsComposition() { var zero = new FunctionZero(); var succ = new FunctionSucc(); var res = succ.exec(zero); var idn = new FunctionI().exec(res); var dubl = new FunctionDbl().exec(idn); Assert.AreEqual(1, (res as Digit).digit); Assert.AreEqual(1, (idn as Digit).digit); Assert.AreEqual(2, (dubl as Digit).digit); }