public void Expression3_ShouldBehaveAsExpected(bool par1, bool par2, bool par3, bool par4) { var expected = par1 || (par2 || par3 && par4); var actual = par1.OR(par3.AND(par4).OR(par2)); //this because AND is executed before OR Assert.AreEqual(expected, actual); }
public static bool NAND(this bool firstValue, bool secondValue) { var and = firstValue.AND(secondValue); var result = and.NOT(); return(result); }
public void Expression1_ShouldBehaveAsExpected(bool par1, bool par2, bool par3) { var expected = (par1 && par2) || (par2 && par3); var actual = par1.AND(par2) .OR(par2.AND(par3)); Assert.AreEqual(expected, actual); }
private static void LogicCheck(bool p, bool q) { Console.WriteLine("p AND q <=> {0}", p.AND(q)); Console.WriteLine("p OR q <=> {0}", p.OR(q)); Console.WriteLine("p XOR q <=> {0}", p.XOR(q)); Console.WriteLine("p IMP q <=> {0}", p.IMP(q)); Console.WriteLine("p NAND q <=> {0}", p.NAND(q)); Console.WriteLine("p EQ q <=> {0}", p.EQ(q)); }
public void AND_WithMultipleParameters_ShouldBehaveAsChainedAnd(bool par1, bool par2, bool par3) { Assert.AreEqual(par1 && par2 && par3, par1.AND(par2, par3)); }
public void AND_ShouldBehaveAsAnd(bool par1, bool par2) { Assert.AreEqual(par1 && par2, par1.AND(par2)); }