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); }
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)); }
/// <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}")); }
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); }
/// <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(); }
public void ReturnsCorrectNewBit(bool expected, bool[] bits) { var sut = new NAnd(new Not(), new And()); Assert.AreEqual(expected, sut.Apply(bits)); }
public void NAndToStringTest1() { var eq = new NAnd(new Bool(true), new Bool(false)); Assert.Equal("True nand False", eq.ToString(commoonFormatter)); }
public void ExecuteResultIsNotSupported() { var exp = new NAnd(new Number(1), new Number(2)); Assert.Throws <ResultIsNotSupportedException>(() => exp.Execute()); }
public void ExecuteTest2() { var nand = new NAnd(new Bool(false), new Bool(true)); Assert.True((bool)nand.Execute()); }
public void ExecuteTest2() { var nand = new NAnd(new Bool(false), new Bool(true)); Assert.Equal(true, nand.Execute()); }
public void TestNAndException() { var exp = new NAnd(new ComplexNumber(1, 2), new ComplexNumber(2, 3)); TestException(exp); }
public void TestNAndComplexBoolException() { var exp = new NAnd(new ComplexNumber(1, 1), new Bool(false)); TestBinaryException(exp); }
public void TestNAndBoolComplexException() { var exp = new NAnd(new Bool(true), new ComplexNumber(1, 1)); TestBinaryException(exp); }
public void TestNAndBoolean() { var exp = new NAnd(new Bool(true), new Bool(false)); Test(exp, ResultType.Boolean); }
public void TestNAndUndefined() { var exp = new NAnd(Variable.X, new Variable("y")); Test(exp, ResultType.Undefined); }