public void Test_Calculator_Bool() { ExpressionTreeCalculator_bool pTree = new ExpressionTreeCalculator_bool(); // 0 == false, 1 == true인 bool 계산기입니다. Calculator_Test_Bool(pTree, "1", true); Calculator_Test_Bool(pTree, "1 & 0", true & false); Calculator_Test_Bool(pTree, "(0 | 1) & (1)", (false | true) & (true)); Calculator_Test_Bool(pTree, "((0 | 1) & (1)) & 1 ^ (1 | 0)", ((false | true) & (true)) & true ^ (true | false)); }
private void Calculator_Test_Bool(ExpressionTreeCalculator_bool pTree, string strLine, bool bValue) { Assert.AreEqual(bValue, pTree.EvaluateExpression(strLine.Replace(" ", "").ToCharArray())); }