1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2015-06-25 20:10:28 -07:00
parent a8c1d14f8a
commit 54f1facfbe

View file

@ -14,11 +14,10 @@ package org.eclipse.cdt.core.parser.tests.scanner;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.IToken;
import junit.framework.TestSuite;
/**
* Scanner2Tests ported to use the CPreprocessor
@ -81,7 +80,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateEOF();
}
// #define f(x) x
// f(f(
public void testMissingParenthesis() throws Exception {
@ -646,7 +644,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// #define A(x,y,z) x + y + z
// #define _t t
// A ( _t , , _t )
@ -658,7 +655,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateIdentifier("t");
}
// #define FOO 5
// # define BAR 10
// int x = FOO + BAR;
@ -689,7 +685,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// #define MAX(a, b) (a) > (b) ? (a) : (b)
// int max = MAX(x, y);
public void testSimpleFunctionLike1() throws Exception {
@ -719,7 +714,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// #define ADD(a, b) (a) + (b)
// #define ADDPART(a) ADD(a
// int sum = ADDPART (x) , y);
@ -742,7 +736,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// #define ADD(a, b) (a) + (b)
// int sum = ADD(x+1,y+1);
public void testSimpleFunctionLike3() throws Exception {
@ -816,7 +809,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
private static StringBuffer getExample3Defines() {
return new StringBuffer()
.append("#define x 3 \n")
@ -836,7 +828,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
}
public void testSpecExample3_1() throws Exception {
StringBuffer sb = getExample3Defines();
sb.append("f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); \n");
@ -892,7 +883,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
public void testSpecExample3_2() throws Exception {
StringBuffer sb = getExample3Defines();
sb.append("g(x+(3,4)-w) | h 5) & m (f)^m(m); \n");
@ -952,7 +942,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
}
public void testSpecExample3_3() throws Exception {
StringBuffer sb = getExample3Defines();
sb.append("p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; \n");
@ -980,7 +969,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
public void testSpecExample3_4() throws Exception {
StringBuffer sb = getExample3Defines();
sb.append("char c[2][6] = { str(hello), str() }; \n"); //31
@ -1007,7 +995,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
private static StringBuffer getExample4Defines() {
return new StringBuffer()
.append("#define str(s) # s \n")
@ -1021,7 +1008,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
.append("#define LOW LOW \", world\" \n");
}
public void testSpecExample4_1() throws Exception {
StringBuffer sb = getExample4Defines();
sb.append("debug(1, 2); \n"); //31
@ -1042,7 +1028,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
public void testSpecExample4_2() throws Exception {
StringBuffer sb = getExample4Defines();
sb.append("fputs(str(strncmp(\"abc\\0d\", \"abc\", '\\4') // this goes away \n");
@ -1062,7 +1047,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
public void testSpecExample4_3() throws Exception {
StringBuffer sb = getExample4Defines();
sb.append("xglue(HIGH, LOW) \n");
@ -1088,7 +1072,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// #define t(x,y,z) x ## y ## z
// int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) };
public void testSpecExample5() throws Exception {
@ -1121,7 +1104,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
public StringBuffer getExample7Defines() {
return new StringBuffer()
.append("#define debug(...) fprintf(stderr, __VA_ARGS__) \n ")
@ -1130,7 +1112,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
.append("printf(__VA_ARGS__)) \n ");
}
public void testSpecExample7_1() throws Exception {
StringBuffer sb = getExample7Defines();
sb.append("debug(\"Flag\"); \n");
@ -1149,7 +1130,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
public void testSpecExample7_2() throws Exception {
StringBuffer sb = getExample7Defines();
sb.append("debug(\"X = %d\\n\", x); \n");
@ -1170,7 +1150,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
public void testSpecExample7_3() throws Exception {
StringBuffer sb = getExample7Defines();
sb.append("showlist(The first, second, and third items.); \n");
@ -1188,7 +1167,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
}
public void testSpecExample7_4() throws Exception {
StringBuffer sb = getExample7Defines();
sb.append("report(x>y, \"x is %d but y is %d\", x, y); \n");
@ -1223,7 +1201,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
}
// #define foo g g g
// #define g f##oo
// foo
@ -1237,7 +1214,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// #define m !(m)+n
// #define n(n) n(m)
// m(m)
@ -1268,7 +1244,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// #define f g
// #define cat(a,b) a ## b
// #define g bad
@ -1282,7 +1257,6 @@ public class PreprocessorTests extends PreprocessorTestsBase {
validateProblemCount(0);
}
// f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
// f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
// int i[] = { 1, 23, 4, 5, };