예제 #1
0
        public void GenerateSimplifiedRowsTest()
        {
            // Test 01
            string expression         = "|(|(a,~(a)), &(%(=(>(~(c),d),e),f), g))";
            AbstractionSyntaxTree ast = new AbstractionSyntaxTree(expression);
            TruthTable            tb  = new TruthTable(ast);


            List <string> rows = new List <string>()
            {
                "******1"
            };


            // Rows without result
            List <string> rowsReturned = tb.GenerateSimplifiedRows();

            for (int i = 0; i < rows.Count; i++)
            {
                Assert.AreEqual(rows[i], rowsReturned[i]);
            }

            // Test 02
            expression = "&(&(a,~(a)), &(%(=(>(~(c),d),e),f), g))";
            ast        = new AbstractionSyntaxTree(expression);
            tb         = new TruthTable(ast);

            rows = new List <string>()
            {
                "******0"
            };

            // Rows without result
            rowsReturned = tb.GenerateSimplifiedRows();

            for (int i = 0; i < rows.Count; i++)
            {
                Assert.AreEqual(rows[i], rowsReturned[i]);
            }
        }