Beispiel #1
0
        internal static void AssertSymbolInTable(string text, int sid, bool duplicate, ISymbolTable symbolTable)
        {
            if (text == null)
            {
                Assert.IsNull(symbolTable.FindKnownSymbol(sid));
                return;
            }

            if (sid != SymbolToken.UnknownSid)
            {
                Assert.AreEqual(text, symbolTable.FindKnownSymbol(sid));
            }

            if (duplicate)
            {
                return;
            }

            Assert.AreEqual(sid, symbolTable.FindSymbolId(text));
            var token = symbolTable.Find(text);

            Assert.AreEqual(SymbolToken.UnknownSid, token.Sid);
            Assert.AreEqual(text, token.Text);

            token = symbolTable.Intern(text);
            Assert.AreEqual(SymbolToken.UnknownSid, token.Sid);
            Assert.AreEqual(text, token.Text);
        }