public void TestVariableParsing()
 {
     foreach (ExpressionTestCase te in validCases)
     {
         expr = new ExpandedBooleanExpression(te.inputExpression);
         CollectionAssert.AreEqual(expr.GetAllVariables(), te.variables);
     }
 }
 public void TestValidExpandedExpressions()
 {
     foreach (ExpressionTestCase t in validCases)
     {
         expr = new ExpandedBooleanExpression(t.inputExpression);
         Assert.AreEqual(t.expectedExpression, expr.ToString());
     }
 }
 public void TestVariableCount()
 {
     foreach (ExpressionTestCase te in validCases)
     {
         expr = new ExpandedBooleanExpression(te.inputExpression);
         Assert.AreEqual(expr.GetVariableCount(), te.variableCount);
     }
 }
 public void TestInvalidExpandedExpressions()
 {
     foreach (InvalidExpressionTestCase t in invalidCases)
     {
         try
         {
             expr = new ExpandedBooleanExpression(t.inputExpression);
         }
         catch (Exception e)
         {
             StringAssert.Contains(e.Message, t.expectedExceptionMessage);
         }
     }
 }
 public ReducedBooleanExpression(ExpandedBooleanExpression bexpr)
 {
     _sortedVariables = bexpr.GetAllVariables();
     ushort index = 0;
     foreach (char c in _sortedVariables)
     {
         _alphabet[c] = index;
         index++;
     }
     Implicant i = null;
     foreach (string factor in bexpr.AsString.Split('+'))
     {
         i = new Implicant(this, factor);
         if ((i == null) || (i.IsContradiction))
             continue;
         _implicants.Add(i);
     }
     //
     CalculatePrimeImplicants();
     BuildMintermToPrimeImplicantTable();
     _mintermCount = _primeImplicantTable.Count();
     PickFinalImplicants();
 }