示例#1
0
 public void ProductionGetHashCodeShouldProduceSameValueForSameObject()
 {
     var production = new Production(new NonTerminal("Z"),
         new CharacterTerminal('a'),
         new NonTerminal("B"),
         new SetTerminal('a','z'));
     var hashCode = production.GetHashCode();
     Assert.AreEqual(hashCode, production.GetHashCode());
 }
示例#2
0
        public void ProductionGetHashCodeShouldProduceSameValueForSameRightHandSides()
        {
            var production1 = new Production(new NonTerminal("A"), new CharacterTerminal('a'), new NonTerminal("B"));
            var production2 = new Production(new NonTerminal("A"), new CharacterTerminal('a'), new NonTerminal("B"));

            Assert.AreEqual(production1.GetHashCode(), production2.GetHashCode());
        }
示例#3
0
 public void ProductionGetHashCodeShouldProduceSameValueForEmptyProductionWithSameLeftHandSide()
 {
     var production1 = new Production(new NonTerminal("A"));
     var production2 = new Production(new NonTerminal("A"));
     Assert.AreEqual(production1.GetHashCode(), production2.GetHashCode());
 }
示例#4
0
 public void ProductionGetHashCodeShouldNotProduceSameValueForDifferentLeftHandSides()
 {
     var production1 = new Production(new NonTerminal("A"));
     var production2 = new Production(new NonTerminal("B"));
     Assert.AreNotEqual(production1.GetHashCode(), production2.GetHashCode());
 }