private void CheckNumberValue(String data, String expectedValue) { PRTokeniser tok = new PRTokeniser(new RandomAccessFileOrArray(GetBytes(data))); tok.NextValidToken(); Assert.AreEqual(PRTokeniser.TokType.NUMBER, tok.TokenType, "Wrong type"); Assert.AreEqual(expectedValue, tok.StringValue, "Wrong multiple minus signs number handling"); }
private void CheckTokenTypes(String data, params PRTokeniser.TokType[] expectedTypes) { PRTokeniser tok = new PRTokeniser(new RandomAccessFileOrArray(GetBytes(data))); for (int i = 0; i < expectedTypes.Length; i++) { tok.NextValidToken(); //System.out.println(tok.getTokenType() + " -> " + tok.getStringValue()); Assert.AreEqual(expectedTypes[i], tok.TokenType, "Position " + i); } }
public void TestPRTokenizer() { String obj = "13 0 obj\n" + "<< /Type /StructElem /Pg 111117220777773888836 0 R>>\n" + "endobj"; PRTokeniser tokens = new PRTokeniser(new RandomAccessFileOrArray(Encoding.ASCII.GetBytes(obj))); for (int i = 0; i < 11; i++) { tokens.NextValidToken(); if (tokens.TokenType == PRTokeniser.TokType.REF) { Assert.IsTrue(tokens.Reference < 0); } if (tokens.TokenType == PRTokeniser.TokType.ENDOFFILE) { break; } } }