public void TestKeywordHashCode() { string s = "foo"; IKeyword k1 = TransitFactory.Keyword("foo"); IKeyword k2 = TransitFactory.Keyword("!foo".Substring(1)); IKeyword k3 = TransitFactory.Keyword("bar"); ISymbol symbol = TransitFactory.Symbol("bar"); Assert.AreEqual(k1.GetHashCode(), k2.GetHashCode()); Assert.IsFalse(k3.GetHashCode() == k1.GetHashCode()); Assert.IsFalse(symbol.GetHashCode() == k1.GetHashCode()); Assert.IsFalse(s.GetHashCode() == k1.GetHashCode()); }
public void TestSymbolHashCode() { string s = "foo"; ISymbol sym1 = TransitFactory.Symbol("foo"); ISymbol sym2 = TransitFactory.Symbol("!foo".Substring(1)); ISymbol sym3 = TransitFactory.Symbol("bar"); IKeyword keyword = TransitFactory.Keyword("bar"); Assert.AreEqual(sym1.GetHashCode(), sym2.GetHashCode()); Assert.IsFalse(sym3.GetHashCode() == sym1.GetHashCode()); Assert.IsFalse(keyword.GetHashCode() == sym1.GetHashCode()); Assert.IsFalse(s.GetHashCode() == sym1.GetHashCode()); }