public void GetTruthValueDictTest() { Variable p = new Variable('p'); Variable q = new Variable('q'); Implication a = new Implication(p, q); Dictionary <char, bool> dict = new Dictionary <char, bool>(); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { dict['p'] = i == 1; dict['q'] = j == 1; Assert.AreEqual(((i ^ 1) | j) == 1, a.GetTruthValue(dict)); } } dict.Remove('p'); Assert.ThrowsException <KeyNotFoundException>( () => a.GetTruthValue(dict)); }
public void GetTruthValueArrayTest() { Variable p = new Variable('p'); Variable q = new Variable('q'); Implication a = new Implication(p, q); bool[] dict = new bool[130]; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { dict['p'] = i == 1; dict['q'] = j == 1; Assert.AreEqual(((i ^ 1) | j) == 1, a.GetTruthValue(dict)); } } }