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); }
public void TestFunctionsSuccAndDbl() { var funf = new Digit(5); var succ = new FunctionSucc(); var res = succ.exec(funf); Assert.AreEqual(true, res.isDigit()); Assert.AreEqual(6, (res as Digit).digit); var dbl = new FunctionDbl(); var res2 = dbl.exec(funf); Assert.AreEqual(true, res2.isDigit()); Assert.AreEqual(10, (res2 as Digit).digit); }