commit 9dfcc04c761ad5d218a1178795398883c0925aba
parent 328388439b2db162f7dedb75db497509131cc745
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 22 May 2026 11:59:54 +0200
tests/cc: Add 0273-cpp.c
Diffstat:
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/tests/cc/execute/0273-cpp.c b/tests/cc/execute/0273-cpp.c
@@ -0,0 +1,33 @@
+#define a(x) # x
+
+static char *s1 = a(3);
+static char *s2 = a( 3 );
+static char *s3 = a( 3 2 );
+static char *s4 = a ( 3
+2);
+static char *s5 = a("3 2 1");
+
+static int
+cmp(char *s1, char *s2)
+{
+ while (*s1 && *s2 && *s1 == *s2)
+ ++s1, ++s2;
+ return *s1 == '\0' && *s2 == '\0';
+}
+
+int
+main(void)
+{
+ if (!cmp(s1, "3"))
+ return 1;
+ if (!cmp(s2, "3"))
+ return 2;
+ if (!cmp(s3, "3 2"))
+ return 3;
+ if (!cmp(s4, "3 2"))
+ return 4;
+ if (!cmp(s5, "\"3 2 1\""))
+ return 5;
+
+ return 0;
+}
diff --git a/tests/cc/execute/scc-tests.lst b/tests/cc/execute/scc-tests.lst
@@ -263,3 +263,4 @@
0270-union.c
0271-struct.c
0272-div.c
+0273-cpp.c