public void ItCanPeekInMinMax() { for (var i = 0; i <= 5; i++) { // delta out of range SigoAssert.ThrowsAny <ArgumentOutOfRangeException>(() => lexer.Peek(-2)); SigoAssert.ThrowsAny <ArgumentOutOfRangeException>(() => lexer.Peek(3)); for (var d = lexer.Max; d >= lexer.Min; d--) { if (i + d < 0) { // negative position SigoAssert.ThrowsAny <Exception>(() => lexer.Peek(d)); } else if (i + d > 5) { // multiple eofs SigoAssert.Equal(Kind.Eof, lexer.Peek(d).Kind); } else { // return the token SigoAssert.Equal((i + d).ToString(), lexer.Peek(d).Raw); } } lexer.Move(1); } }
public void PropertiesTest() { SigoAssert.Equal(-1, lexer.Min); SigoAssert.Equal(2, lexer.Max); SigoAssert.Equal(0, lexer.Cursor); lexer.Move(2); SigoAssert.Equal(2, lexer.Cursor); SigoAssert.Equal("2", lexer.Peek(0).Raw); lexer.Move(2); SigoAssert.Equal(4, lexer.Cursor); SigoAssert.Equal("4", lexer.Peek(0).Raw); lexer.Peek(lexer.Max); // after peek max, you can Move min, but not min-1 lexer.Move(-1); SigoAssert.Equal(3, lexer.Cursor); SigoAssert.Equal("3", lexer.Peek(0).Raw); SigoAssert.ThrowsAny <Exception>(() => lexer.Peek(-1)); // after move(-1) you have limitation SigoAssert.ThrowsAny <Exception>(() => lexer.Move(-1)); }
public void TODO_Assign_to_literal(string name) { SigoAssert.ThrowsAny <Exception>(() => Sigo.Parse(name + " = 1")); }
public void TODO_ArrayErrorTest(string src) { SigoAssert.ThrowsAny <Exception>(() => Sigo.Parse(src)); }
public void Object_errorTests(string src) { SigoAssert.ThrowsAny <Exception>(() => Sigo.Parse(src)); }