public void TokensWithTheSameTypeAreAlwaysTheSame() { Assert.That(DefinitionToken.Close, Is.EqualTo(DefinitionToken.Close)); Assert.That(DefinitionToken.FromIdentifier("abc"), Is.EqualTo(DefinitionToken.FromIdentifier("abc"))); Assert.That(DefinitionToken.FromNumber("123"), Is.EqualTo(DefinitionToken.FromNumber(123))); }
public void CheckTokenType() { Assert.That(DefinitionToken.Open.IsIdentifier, Is.False); Assert.That(DefinitionToken.Open.IsNumber, Is.False); Assert.That(DefinitionToken.Close.IsText, Is.False); Assert.That(DefinitionToken.FromIdentifier(nameof(CheckTokenType)).IsIdentifier, Is.True); Assert.That(DefinitionToken.FromNumber(5).IsNumber, Is.True); Assert.That(DefinitionToken.FromText(nameof(TokenTests)).IsText, Is.True); }
public void FindSingleToken() { CheckSingleToken(" test(", DefinitionToken.Open); CheckSingleToken(" test(number)", DefinitionToken.Close); /*unused * CheckSingleToken(" is", DefinitionToken.Is); * CheckSingleToken(" test", DefinitionToken.Test); */ CheckSingleToken(" 53", DefinitionToken.FromNumber(53)); CheckSingleToken(" number", DefinitionToken.FromIdentifier("number")); }
public void TokenToString() { Assert.That(DefinitionToken.Open.ToString(), Is.EqualTo("(")); Assert.That(DefinitionToken.FromNumber(123).ToString(), Is.EqualTo("123")); Assert.That(DefinitionToken.FromIdentifier("Hello").ToString(), Is.EqualTo("Hello")); }