public void Setup()
 {
     _and           = new And();
     _not           = new Not();
     _nAnd          = new NAnd(_not, _and);
     _or            = new Or(_not, _nAnd);
     _xOr           = new XOr(_not, _nAnd);
     _bitComparator = new BitComparator(_xOr, _and, _or, _not);
 }
Ejemplo n.º 2
0
        private static BitAdder Create()
        {
            var and  = new And();
            var not  = new Not();
            var nAnd = new NAnd(not, and);
            var or   = new Or(not, nAnd);

            return(new BitAdder(new XOr(not, nAnd), or, and));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Analyzes the specified expression.
        /// </summary>
        /// <param name="exp">The expression.</param>
        /// <returns>The result of analysis.</returns>
        public string Analyze(NAnd exp)
        {
            if (exp.Parent is BinaryExpression)
            {
                return(ToString(exp, "({0} nand {1})"));
            }

            return(ToString(exp, "{0} nand {1}"));
        }
Ejemplo n.º 4
0
 public void Setup()
 {
     _byteFactory   = new ByteFactory(new Base10Converter());
     _and           = new And();
     _not           = new Not();
     _nAnd          = new NAnd(_not, _and);
     _or            = new Or(_not, _nAnd);
     _xOr           = new XOr(_not, _nAnd);
     _bitComparator = new BitComparator(_xOr, _and, _or, _not);
     _byteToBase10  = new ByteToBase10Converter(_byteFactory, new Base10Converter());
     _sut           = new ByteComparator(_bitComparator, _byteFactory);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Analyzes the specified expression.
 /// </summary>
 /// <param name="exp">The expression.</param>
 /// <returns>
 /// The result of analysis.
 /// </returns>
 /// <exception cref="System.NotSupportedException">Always.</exception>
 public virtual TResult Analyze(NAnd exp)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 6
0
        public void ReturnsCorrectNewBit(bool expected, bool[] bits)
        {
            var sut = new NAnd(new Not(), new And());

            Assert.AreEqual(expected, sut.Apply(bits));
        }
Ejemplo n.º 7
0
        public void NAndToStringTest1()
        {
            var eq = new NAnd(new Bool(true), new Bool(false));

            Assert.Equal("True nand False", eq.ToString(commoonFormatter));
        }
Ejemplo n.º 8
0
        public void ExecuteResultIsNotSupported()
        {
            var exp = new NAnd(new Number(1), new Number(2));

            Assert.Throws <ResultIsNotSupportedException>(() => exp.Execute());
        }
Ejemplo n.º 9
0
        public void ExecuteTest2()
        {
            var nand = new NAnd(new Bool(false), new Bool(true));

            Assert.True((bool)nand.Execute());
        }
Ejemplo n.º 10
0
        public void ExecuteTest2()
        {
            var nand = new NAnd(new Bool(false), new Bool(true));

            Assert.Equal(true, nand.Execute());
        }
Ejemplo n.º 11
0
        public void TestNAndException()
        {
            var exp = new NAnd(new ComplexNumber(1, 2), new ComplexNumber(2, 3));

            TestException(exp);
        }
Ejemplo n.º 12
0
        public void TestNAndComplexBoolException()
        {
            var exp = new NAnd(new ComplexNumber(1, 1), new Bool(false));

            TestBinaryException(exp);
        }
Ejemplo n.º 13
0
        public void TestNAndBoolComplexException()
        {
            var exp = new NAnd(new Bool(true), new ComplexNumber(1, 1));

            TestBinaryException(exp);
        }
Ejemplo n.º 14
0
        public void TestNAndBoolean()
        {
            var exp = new NAnd(new Bool(true), new Bool(false));

            Test(exp, ResultType.Boolean);
        }
Ejemplo n.º 15
0
        public void TestNAndUndefined()
        {
            var exp = new NAnd(Variable.X, new Variable("y"));

            Test(exp, ResultType.Undefined);
        }