public void FunctionAndFullTest() { this.TestFunction( (state, param, result) => FunctionAnd.Create(state, param, result), (state, param, result) => { bool value = true; foreach (int p in param) { value &= (state[p] != State.On0); } return(value ? state[result] == State.On1 : state[result] == State.On0); } ); }
public void CircuitStateEvaluateTest() { CircuitState target = new CircuitState(3); OneBitConst c1 = new OneBitConst(target, State.On0, 0); OneBitConst c2 = new OneBitConst(target, State.On1, 1); FunctionAnd and = FunctionAnd.Create(target, new int[] { 0, 1 }, 2); target.EndDefinition(); bool success = target.Evaluate(true); Assert.IsTrue(success); Assert.AreEqual <State>(State.On0, target[0]); Assert.AreEqual <State>(State.On1, target[1]); Assert.AreEqual <State>(State.On0, target[2]); }