Esempio n. 1
0
 @Test(timeout = 1000)
 public void checkLexerTokens() throws Exception {
   final String text = this.getTextFromFile("res/Test0004_Typedefs.c");
   final String[] expected =
       new String[] {
         "RULE_KW_TYPEDEF",
         "RULE_WHITESPACE",
         "RULE_KW_INT",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
         "RULE_KW_TYPEDEF",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
         "RULE_ID",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
         "RULE_ID",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
       };
   // final List<Token> actual = testHelper.getTokens(text);
   // testHelper.outputTokens(text);
   testHelper.checkTokenisation(text, expected);
 }
 @Test(timeout = 1000)
 public void checkLexerTokens() throws Exception {
   final String text = this.getTextFromFile("res/Test0005_FunctionDecls.c");
   final String[] expected =
       new String[] {
         "RULE_KW_CHAR",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_LEFTPAREN",
         "RULE_SKW_RIGHTPAREN",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
         "RULE_KW_DOUBLE",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_LEFTPAREN",
         "RULE_SKW_RIGHTPAREN",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
         "RULE_KW_FLOAT",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_LEFTPAREN",
         "RULE_SKW_RIGHTPAREN",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
         "RULE_KW_INT",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_LEFTPAREN",
         "RULE_SKW_RIGHTPAREN",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
         "RULE_KW_VOID",
         "RULE_WHITESPACE",
         "RULE_ID",
         "RULE_SKW_LEFTPAREN",
         "RULE_SKW_RIGHTPAREN",
         "RULE_SKW_SEMI",
         "RULE_NEWLINE",
       };
   // final List<Token> actual = testHelper.getTokens(text);
   // testHelper.outputTokens(text);
   testHelper.checkTokenisation(text, expected);
 }