示例#1
0
        public void GenerateRowsTest()
        {
            // Test 01
            string expression         = "=(a,b)";
            AbstractionSyntaxTree ast = new AbstractionSyntaxTree(expression);
            TruthTable            tb  = new TruthTable(ast);


            List <string> rows = new List <string>()
            {
                "00", "01", "10", "11"
            };
            string rowsResult = "1001";

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

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

            // Rows With Result
            for (int i = 0; i < rows.Count; i++)
            {
                rows[i] = rows[i] + rowsResult[i];
            }

            rowsReturned = tb.GenerateRows(true);

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

            // End test 01
        }