@Test(timeout = 1000) public void checkParserResult() throws Exception { final String text = this.getTextFromFile("res/Test0030_ObjectLikeMacro.c"); final Preprocess Preprocess_0_Var = this.parseHelper.parse(text); this.valHelper.assertNoErrors(Preprocess_0_Var); Assert.assertNotNull(Preprocess_0_Var); // 0 final GroupOpt GroupOpt_1_Var = (GroupOpt) Preprocess_0_Var.getGroup(); Assert.assertNotNull(GroupOpt_1_Var); final EList<? extends EObject> Lines_1_list = GroupOpt_1_Var.getLines(); Assert.assertNotNull(Lines_1_list); Assert.assertEquals(3, Lines_1_list.size()); // 1 final Code Code_2_Var = (Code) Lines_1_list.get(0); Assert.assertNotNull(Code_2_Var); Assert.assertEquals("int foo1 = BAR;", Code_2_Var.getCode()); // 2 final PreprocessorDirectives PreprocessorDirectives_3_Var = (PreprocessorDirectives) Lines_1_list.get(1); Assert.assertNotNull(PreprocessorDirectives_3_Var); // 3 final DefineObjectMacro DefineObjectMacro_4_Var = (DefineObjectMacro) PreprocessorDirectives_3_Var.getDirective(); Assert.assertNotNull(DefineObjectMacro_4_Var); Assert.assertEquals("BAR", DefineObjectMacro_4_Var.getIdent()); Assert.assertEquals("0", DefineObjectMacro_4_Var.getString()); // 4 final Code Code_5_Var = (Code) Lines_1_list.get(2); Assert.assertNotNull(Code_5_Var); Assert.assertEquals("int foo2 = BAR;", Code_5_Var.getCode()); }
@Test(timeout = 1000) public void checkParserResult() throws Exception { final String text = this.getTextFromFile("res/Test0139_LineBreakInString.c"); final Preprocess Preprocess_0_Var = this.parseHelper.parse(text); this.valHelper.assertNoErrors(Preprocess_0_Var); Assert.assertNotNull(Preprocess_0_Var); // 0 final GroupOpt GroupOpt_1_Var = (GroupOpt) Preprocess_0_Var.getGroup(); Assert.assertNotNull(GroupOpt_1_Var); final EList<? extends EObject> Lines_1_list = GroupOpt_1_Var.getLines(); Assert.assertNotNull(Lines_1_list); Assert.assertEquals(6, Lines_1_list.size()); // 1 final PreprocessorDirectives PreprocessorDirectives_2_Var = (PreprocessorDirectives) Lines_1_list.get(0); Assert.assertNotNull(PreprocessorDirectives_2_Var); // 2 final DefineObjectMacro DefineObjectMacro_3_Var = (DefineObjectMacro) PreprocessorDirectives_2_Var.getDirective(); Assert.assertNotNull(DefineObjectMacro_3_Var); Assert.assertEquals("NAME", DefineObjectMacro_3_Var.getIdent()); Assert.assertEquals("\"Nobody\\nSomebody\"", DefineObjectMacro_3_Var.getString()); // 3 final Code Code_4_Var = (Code) Lines_1_list.get(1); Assert.assertNotNull(Code_4_Var); Assert.assertEquals("NAME", Code_4_Var.getCode()); // 4 final NewLineLine NewLineLine_5_Var = (NewLineLine) Lines_1_list.get(2); Assert.assertNotNull(NewLineLine_5_Var); // 5 final Code Code_6_Var = (Code) Lines_1_list.get(3); Assert.assertNotNull(Code_6_Var); Assert.assertEquals("void foo() {", Code_6_Var.getCode()); // 6 final Code Code_7_Var = (Code) Lines_1_list.get(4); Assert.assertNotNull(Code_7_Var); Assert.assertEquals(" printf(\"Nobody\\n\\nSomething\");", Code_7_Var.getCode()); // 7 final Code Code_8_Var = (Code) Lines_1_list.get(5); Assert.assertNotNull(Code_8_Var); Assert.assertEquals("}", Code_8_Var.getCode()); }
@Test(timeout = 1000) public void checkParserResult() throws Exception { final String text = this.getTextFromFile("res/Test0129_ConcatenateDouble.c"); final Preprocess Preprocess_0_Var = this.parseHelper.parse(text); this.valHelper.assertNoErrors(Preprocess_0_Var); Assert.assertNotNull(Preprocess_0_Var); // 0 final GroupOpt GroupOpt_1_Var = (GroupOpt) Preprocess_0_Var.getGroup(); Assert.assertNotNull(GroupOpt_1_Var); final EList<? extends EObject> Lines_1_list = GroupOpt_1_Var.getLines(); Assert.assertNotNull(Lines_1_list); Assert.assertEquals(9, Lines_1_list.size()); // 1 final PreprocessorDirectives PreprocessorDirectives_2_Var = (PreprocessorDirectives) Lines_1_list.get(0); Assert.assertNotNull(PreprocessorDirectives_2_Var); // 2 final DefineFunctionLikeMacro DefineFunctionLikeMacro_3_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_2_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_3_Var); Assert.assertEquals("FOO", DefineFunctionLikeMacro_3_Var.getIdent()); // 3 final IdentifierList IdentifierList_4_Var = (IdentifierList) DefineFunctionLikeMacro_3_Var.getList(); Assert.assertNotNull(IdentifierList_4_Var); Assert.assertEquals("[X, Y, Z]", IdentifierList_4_Var.getIdent().toString()); Assert.assertFalse(IdentifierList_4_Var.isVariadic()); Assert.assertEquals("printf(X##Y ## Z)", DefineFunctionLikeMacro_3_Var.getString()); // 4 final PreprocessorDirectives PreprocessorDirectives_5_Var = (PreprocessorDirectives) Lines_1_list.get(1); Assert.assertNotNull(PreprocessorDirectives_5_Var); // 5 final DefineFunctionLikeMacro DefineFunctionLikeMacro_6_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_5_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_6_Var); Assert.assertEquals("BAR", DefineFunctionLikeMacro_6_Var.getIdent()); // 6 final IdentifierList IdentifierList_7_Var = (IdentifierList) DefineFunctionLikeMacro_6_Var.getList(); Assert.assertNotNull(IdentifierList_7_Var); Assert.assertEquals("[X, Y, Z]", IdentifierList_7_Var.getIdent().toString()); Assert.assertFalse(IdentifierList_7_Var.isVariadic()); Assert.assertEquals("printf(X ## Y##Z)", DefineFunctionLikeMacro_6_Var.getString()); // 7 final PreprocessorDirectives PreprocessorDirectives_8_Var = (PreprocessorDirectives) Lines_1_list.get(2); Assert.assertNotNull(PreprocessorDirectives_8_Var); // 8 final DefineFunctionLikeMacro DefineFunctionLikeMacro_9_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_8_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_9_Var); Assert.assertEquals("BAZ", DefineFunctionLikeMacro_9_Var.getIdent()); // 9 final IdentifierList IdentifierList_10_Var = (IdentifierList) DefineFunctionLikeMacro_9_Var.getList(); Assert.assertNotNull(IdentifierList_10_Var); Assert.assertEquals("[X, Y, Z]", IdentifierList_10_Var.getIdent().toString()); Assert.assertFalse(IdentifierList_10_Var.isVariadic()); Assert.assertEquals("printf(X##Y##Z)", DefineFunctionLikeMacro_9_Var.getString()); // 10 final Code Code_11_Var = (Code) Lines_1_list.get(3); Assert.assertNotNull(Code_11_Var); Assert.assertEquals("FOO(a, b, c);", Code_11_Var.getCode()); // 11 final Code Code_12_Var = (Code) Lines_1_list.get(4); Assert.assertNotNull(Code_12_Var); Assert.assertEquals("FOO(foo, bar, baz);", Code_12_Var.getCode()); // 12 final Code Code_13_Var = (Code) Lines_1_list.get(5); Assert.assertNotNull(Code_13_Var); Assert.assertEquals("BAR(a, b, c);", Code_13_Var.getCode()); // 13 final Code Code_14_Var = (Code) Lines_1_list.get(6); Assert.assertNotNull(Code_14_Var); Assert.assertEquals("BAR(foo, bar, baz);", Code_14_Var.getCode()); // 14 final Code Code_15_Var = (Code) Lines_1_list.get(7); Assert.assertNotNull(Code_15_Var); Assert.assertEquals("BAZ(a, b, c);", Code_15_Var.getCode()); // 15 final Code Code_16_Var = (Code) Lines_1_list.get(8); Assert.assertNotNull(Code_16_Var); Assert.assertEquals("BAZ(foo, bar, baz);", Code_16_Var.getCode()); }
@Test(timeout = 1000) public void checkParserResult() throws Exception { final String text = this.getTextFromFile("res/Test0045_IfValueGreater.c"); final Preprocess Preprocess_0_Var = this.parseHelper.parse(text); this.valHelper.assertNoErrors(Preprocess_0_Var); Assert.assertNotNull(Preprocess_0_Var); // 0 final GroupOpt GroupOpt_1_Var = (GroupOpt) Preprocess_0_Var.getGroup(); Assert.assertNotNull(GroupOpt_1_Var); final EList<? extends EObject> Lines_1_list = GroupOpt_1_Var.getLines(); Assert.assertNotNull(Lines_1_list); Assert.assertEquals(2, Lines_1_list.size()); // 1 final PreprocessorDirectives PreprocessorDirectives_2_Var = (PreprocessorDirectives) Lines_1_list.get(0); Assert.assertNotNull(PreprocessorDirectives_2_Var); // 2 final DefineObjectMacro DefineObjectMacro_3_Var = (DefineObjectMacro) PreprocessorDirectives_2_Var.getDirective(); Assert.assertNotNull(DefineObjectMacro_3_Var); Assert.assertEquals("VERSION", DefineObjectMacro_3_Var.getIdent()); Assert.assertEquals("290", DefineObjectMacro_3_Var.getString()); // 3 final PreprocessorDirectives PreprocessorDirectives_4_Var = (PreprocessorDirectives) Lines_1_list.get(1); Assert.assertNotNull(PreprocessorDirectives_4_Var); // 4 final ConditionalDirective ConditionalDirective_5_Var = (ConditionalDirective) PreprocessorDirectives_4_Var.getDirective(); Assert.assertNotNull(ConditionalDirective_5_Var); // 5 final IfConditional IfConditional_6_Var = (IfConditional) ConditionalDirective_5_Var.getConditional(); Assert.assertNotNull(IfConditional_6_Var); // 6 final RelationalExpression RelationalExpression_7_Var = (RelationalExpression) IfConditional_6_Var.getExpression(); Assert.assertNotNull(RelationalExpression_7_Var); Assert.assertEquals(">=", RelationalExpression_7_Var.getOp()); // 7 final PrimaryExpression PrimaryExpression_8_Var = (PrimaryExpression) RelationalExpression_7_Var.getLeft(); Assert.assertNotNull(PrimaryExpression_8_Var); Assert.assertEquals("VERSION", PrimaryExpression_8_Var.getIdent()); // 8 final PrimaryExpression PrimaryExpression_9_Var = (PrimaryExpression) RelationalExpression_7_Var.getRight(); Assert.assertNotNull(PrimaryExpression_9_Var); Assert.assertEquals("200", PrimaryExpression_9_Var.getConst()); // 9 final GroupOpt GroupOpt_10_Var = (GroupOpt) IfConditional_6_Var.getGroup(); Assert.assertNotNull(GroupOpt_10_Var); final EList<? extends EObject> Lines_10_list = GroupOpt_10_Var.getLines(); Assert.assertNotNull(Lines_10_list); Assert.assertEquals(1, Lines_10_list.size()); // 10 final Code Code_11_Var = (Code) Lines_10_list.get(0); Assert.assertNotNull(Code_11_Var); Assert.assertEquals(" void api_version_2();", Code_11_Var.getCode()); }
@Test(timeout = 1000) public void checkParserResult() throws Exception { final String text = this.getTextFromFile("res/Test0135_AnotherConcatenate.c"); final Preprocess Preprocess_0_Var = this.parseHelper.parse(text); this.valHelper.assertNoErrors(Preprocess_0_Var); Assert.assertNotNull(Preprocess_0_Var); // 0 final GroupOpt GroupOpt_1_Var = (GroupOpt) Preprocess_0_Var.getGroup(); Assert.assertNotNull(GroupOpt_1_Var); final EList<? extends EObject> Lines_1_list = GroupOpt_1_Var.getLines(); Assert.assertNotNull(Lines_1_list); Assert.assertEquals(25, Lines_1_list.size()); // 1 final PreprocessorDirectives PreprocessorDirectives_2_Var = (PreprocessorDirectives) Lines_1_list.get(0); Assert.assertNotNull(PreprocessorDirectives_2_Var); // 2 final DefineObjectMacro DefineObjectMacro_3_Var = (DefineObjectMacro) PreprocessorDirectives_2_Var.getDirective(); Assert.assertNotNull(DefineObjectMacro_3_Var); Assert.assertEquals("FOO1", DefineObjectMacro_3_Var.getIdent()); Assert.assertEquals("0,", DefineObjectMacro_3_Var.getString()); // 3 final PreprocessorDirectives PreprocessorDirectives_4_Var = (PreprocessorDirectives) Lines_1_list.get(1); Assert.assertNotNull(PreprocessorDirectives_4_Var); // 4 final DefineFunctionLikeMacro DefineFunctionLikeMacro_5_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_4_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_5_Var); Assert.assertEquals("BAR", DefineFunctionLikeMacro_5_Var.getIdent()); // 5 final IdentifierList IdentifierList_6_Var = (IdentifierList) DefineFunctionLikeMacro_5_Var.getList(); Assert.assertNotNull(IdentifierList_6_Var); Assert.assertEquals("[X, Y]", IdentifierList_6_Var.getIdent().toString()); Assert.assertEquals("BAZ(X, Y)", DefineFunctionLikeMacro_5_Var.getString()); // 6 final PreprocessorDirectives PreprocessorDirectives_7_Var = (PreprocessorDirectives) Lines_1_list.get(2); Assert.assertNotNull(PreprocessorDirectives_7_Var); // 7 final DefineFunctionLikeMacro DefineFunctionLikeMacro_8_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_7_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_8_Var); Assert.assertEquals("BAZ", DefineFunctionLikeMacro_8_Var.getIdent()); // 8 final IdentifierList IdentifierList_9_Var = (IdentifierList) DefineFunctionLikeMacro_8_Var.getList(); Assert.assertNotNull(IdentifierList_9_Var); Assert.assertEquals("[X, Y]", IdentifierList_9_Var.getIdent().toString()); Assert.assertTrue(IdentifierList_9_Var.isVariadic()); Assert.assertEquals("X##Y", DefineFunctionLikeMacro_8_Var.getString()); // 9 final PreprocessorDirectives PreprocessorDirectives_10_Var = (PreprocessorDirectives) Lines_1_list.get(3); Assert.assertNotNull(PreprocessorDirectives_10_Var); // 10 final DefineFunctionLikeMacro DefineFunctionLikeMacro_11_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_10_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_11_Var); Assert.assertEquals("FOOBAR", DefineFunctionLikeMacro_11_Var.getIdent()); // 11 final IdentifierList IdentifierList_12_Var = (IdentifierList) DefineFunctionLikeMacro_11_Var.getList(); Assert.assertNotNull(IdentifierList_12_Var); Assert.assertEquals("[X, Y]", IdentifierList_12_Var.getIdent().toString()); Assert.assertEquals("foobar(X, Y)", DefineFunctionLikeMacro_11_Var.getString()); // 12 final PreprocessorDirectives PreprocessorDirectives_13_Var = (PreprocessorDirectives) Lines_1_list.get(4); Assert.assertNotNull(PreprocessorDirectives_13_Var); // 13 final DefineFunctionLikeMacro DefineFunctionLikeMacro_14_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_13_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_14_Var); Assert.assertEquals("BAR2", DefineFunctionLikeMacro_14_Var.getIdent()); // 14 final IdentifierList IdentifierList_15_Var = (IdentifierList) DefineFunctionLikeMacro_14_Var.getList(); Assert.assertNotNull(IdentifierList_15_Var); Assert.assertEquals("[X, Y]", IdentifierList_15_Var.getIdent().toString()); Assert.assertEquals("BAZ2(X, Y)", DefineFunctionLikeMacro_14_Var.getString()); // 15 final PreprocessorDirectives PreprocessorDirectives_16_Var = (PreprocessorDirectives) Lines_1_list.get(5); Assert.assertNotNull(PreprocessorDirectives_16_Var); // 16 final DefineFunctionLikeMacro DefineFunctionLikeMacro_17_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_16_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_17_Var); Assert.assertEquals("BAZ2", DefineFunctionLikeMacro_17_Var.getIdent()); // 17 final IdentifierList IdentifierList_18_Var = (IdentifierList) DefineFunctionLikeMacro_17_Var.getList(); Assert.assertNotNull(IdentifierList_18_Var); Assert.assertEquals("[X, Y]", IdentifierList_18_Var.getIdent().toString()); Assert.assertTrue(IdentifierList_18_Var.isVariadic()); Assert.assertEquals("X##__VA_ARGS__", DefineFunctionLikeMacro_17_Var.getString()); // 18 final PreprocessorDirectives PreprocessorDirectives_19_Var = (PreprocessorDirectives) Lines_1_list.get(6); Assert.assertNotNull(PreprocessorDirectives_19_Var); // 19 final DefineFunctionLikeMacro DefineFunctionLikeMacro_20_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_19_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_20_Var); Assert.assertEquals("FOOBAR2", DefineFunctionLikeMacro_20_Var.getIdent()); // 20 final IdentifierList IdentifierList_21_Var = (IdentifierList) DefineFunctionLikeMacro_20_Var.getList(); Assert.assertNotNull(IdentifierList_21_Var); Assert.assertEquals("[X]", IdentifierList_21_Var.getIdent().toString()); Assert.assertEquals("foobar2(FOO1, X)", DefineFunctionLikeMacro_20_Var.getString()); // 21 final PreprocessorDirectives PreprocessorDirectives_22_Var = (PreprocessorDirectives) Lines_1_list.get(7); Assert.assertNotNull(PreprocessorDirectives_22_Var); // 22 final DefineObjectMacro DefineObjectMacro_23_Var = (DefineObjectMacro) PreprocessorDirectives_22_Var.getDirective(); Assert.assertNotNull(DefineObjectMacro_23_Var); Assert.assertEquals("FOO2", DefineObjectMacro_23_Var.getIdent()); Assert.assertNull(DefineObjectMacro_23_Var.getString()); // 23 final PreprocessorDirectives PreprocessorDirectives_24_Var = (PreprocessorDirectives) Lines_1_list.get(8); Assert.assertNotNull(PreprocessorDirectives_24_Var); // 24 final DefineFunctionLikeMacro DefineFunctionLikeMacro_25_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_24_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_25_Var); Assert.assertEquals("BAR3", DefineFunctionLikeMacro_25_Var.getIdent()); // 25 final IdentifierList IdentifierList_26_Var = (IdentifierList) DefineFunctionLikeMacro_25_Var.getList(); Assert.assertNotNull(IdentifierList_26_Var); Assert.assertEquals("[X]", IdentifierList_26_Var.getIdent().toString()); Assert.assertEquals("BAZ3(X)", DefineFunctionLikeMacro_25_Var.getString()); // 26 final PreprocessorDirectives PreprocessorDirectives_27_Var = (PreprocessorDirectives) Lines_1_list.get(9); Assert.assertNotNull(PreprocessorDirectives_27_Var); // 27 final DefineFunctionLikeMacro DefineFunctionLikeMacro_28_Var = (DefineFunctionLikeMacro) PreprocessorDirectives_27_Var.getDirective(); Assert.assertNotNull(DefineFunctionLikeMacro_28_Var); Assert.assertEquals("BAZ3", DefineFunctionLikeMacro_28_Var.getIdent()); // 28 final IdentifierList IdentifierList_29_Var = (IdentifierList) DefineFunctionLikeMacro_28_Var.getList(); Assert.assertNotNull(IdentifierList_29_Var); Assert.assertEquals("[X]", IdentifierList_29_Var.getIdent().toString()); Assert.assertFalse(IdentifierList_29_Var.isVariadic()); Assert.assertEquals("foobar3(FOO##X)", DefineFunctionLikeMacro_28_Var.getString()); // 29 final Code Code_30_Var = (Code) Lines_1_list.get(10); Assert.assertNotNull(Code_30_Var); Assert.assertEquals("FOOBAR(0, 1)", Code_30_Var.getCode()); // 30 final Code Code_31_Var = (Code) Lines_1_list.get(11); Assert.assertNotNull(Code_31_Var); Assert.assertEquals("FOOBAR(FOO1, 1)", Code_31_Var.getCode()); // 31 final Code Code_32_Var = (Code) Lines_1_list.get(12); Assert.assertNotNull(Code_32_Var); Assert.assertEquals("FOOBAR(1, FOO1)", Code_32_Var.getCode()); // 32 final Code Code_33_Var = (Code) Lines_1_list.get(13); Assert.assertNotNull(Code_33_Var); Assert.assertEquals("BAR(0, 1)", Code_33_Var.getCode()); // 33 final Code Code_34_Var = (Code) Lines_1_list.get(14); Assert.assertNotNull(Code_34_Var); Assert.assertEquals("BAR(FOO1, 1)", Code_34_Var.getCode()); // 34 final Code Code_35_Var = (Code) Lines_1_list.get(15); Assert.assertNotNull(Code_35_Var); Assert.assertEquals("BAR(1, FOO1)", Code_35_Var.getCode()); // 35 final Code Code_36_Var = (Code) Lines_1_list.get(16); Assert.assertNotNull(Code_36_Var); Assert.assertEquals("BAR2(0, 1)", Code_36_Var.getCode()); // 36 final Code Code_37_Var = (Code) Lines_1_list.get(17); Assert.assertNotNull(Code_37_Var); Assert.assertEquals("BAR2(FOO1, 1)", Code_37_Var.getCode()); // 37 final Code Code_38_Var = (Code) Lines_1_list.get(18); Assert.assertNotNull(Code_38_Var); Assert.assertEquals("BAR2(1, FOO1)", Code_38_Var.getCode()); // 38 final Code Code_39_Var = (Code) Lines_1_list.get(19); Assert.assertNotNull(Code_39_Var); Assert.assertEquals("FOOBAR2(0)", Code_39_Var.getCode()); // 39 final Code Code_40_Var = (Code) Lines_1_list.get(20); Assert.assertNotNull(Code_40_Var); Assert.assertEquals("FOOBAR2(1)", Code_40_Var.getCode()); // 40 final Code Code_41_Var = (Code) Lines_1_list.get(21); Assert.assertNotNull(Code_41_Var); Assert.assertEquals("FOOBAR2(FOO2)", Code_41_Var.getCode()); // 41 final Code Code_42_Var = (Code) Lines_1_list.get(22); Assert.assertNotNull(Code_42_Var); Assert.assertEquals("BAR3(1)", Code_42_Var.getCode()); // 42 final Code Code_43_Var = (Code) Lines_1_list.get(23); Assert.assertNotNull(Code_43_Var); Assert.assertEquals("BAR3(2)", Code_43_Var.getCode()); // 43 final Code Code_44_Var = (Code) Lines_1_list.get(24); Assert.assertNotNull(Code_44_Var); Assert.assertEquals("BAR3(FOO2)", Code_44_Var.getCode()); }