Ejemplo n.º 1
0
        public void TestCaseImplicantTableConstructsAndPrintsCorrectlyForThreeLiterals()
        {
            var resultString = new ImplicantTable(new List<Implicant>()
            {
                new Implicant(new[] { Literal.Negative, Literal.Negative, Literal.Negative}),
                new Implicant(new[] { Literal.Negative, Literal.Negative, Literal.Positive}),
                new Implicant(new[] { Literal.Negative, Literal.Positive, Literal.Negative}),
                new Implicant(new[] { Literal.Negative, Literal.Positive, Literal.Positive}),
                new Implicant(new[] { Literal.Positive, Literal.Negative, Literal.Negative}),
                new Implicant(new[] { Literal.Positive, Literal.Negative, Literal.Positive}),
                new Implicant(new[] { Literal.Positive, Literal.Positive, Literal.Negative}),
                new Implicant(new[] { Literal.Positive, Literal.Positive, Literal.Positive})
            }).ToString();

            Assert.AreEqual(ExpectedString, resultString);
        }
Ejemplo n.º 2
0
        public void TestCaseImplicantTablePrimeImplicants()
        {
            var expectedPrimeImplicant = new Implicant(new[] {Literal.DontCare, Literal.DontCare, Literal.DontCare});
            var implicantTable = new ImplicantTable(new List<Implicant>()
            {
                new Implicant(new[] { Literal.Negative, Literal.Negative, Literal.Negative}),
                new Implicant(new[] { Literal.Negative, Literal.Negative, Literal.Positive}),
                new Implicant(new[] { Literal.Negative, Literal.Positive, Literal.Negative}),
                new Implicant(new[] { Literal.Negative, Literal.Positive, Literal.Positive}),
                new Implicant(new[] { Literal.Positive, Literal.Negative, Literal.Negative}),
                new Implicant(new[] { Literal.Positive, Literal.Negative, Literal.Positive}),
                new Implicant(new[] { Literal.Positive, Literal.Positive, Literal.Negative}),
                new Implicant(new[] { Literal.Positive, Literal.Positive, Literal.Positive})
            });

            var primeImplicants = implicantTable.GetPrimeImplicants();
            var primeImplicant = primeImplicants[0];

            Assert.AreEqual(expectedPrimeImplicant, primeImplicant);
        }