aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2023-06-05 10:28:57 +0200
committerlemon <lsof@mailbox.org>2023-06-05 10:58:35 +0200
commited47a54958f5bd48dc364d4a0f77f778768696bb (patch)
treec68f7b1426c198964b37238c6195f0569a15ab2b /test
parentefc0cf8039cbff5e0f0d52fd7414c7186129b6ac (diff)
strlits
Diffstat (limited to 'test')
-rw-r--r--test/hello.c5
-rw-r--r--test/test.c97
-rw-r--r--test/test2.c23
3 files changed, 125 insertions, 0 deletions
diff --git a/test/hello.c b/test/hello.c
new file mode 100644
index 0000000..98a93a0
--- /dev/null
+++ b/test/hello.c
@@ -0,0 +1,5 @@
+int printf(const char *, ...);
+
+int main() {
+ printf("hello world\n");
+}
diff --git a/test/test.c b/test/test.c
new file mode 100644
index 0000000..40b59e6
--- /dev/null
+++ b/test/test.c
@@ -0,0 +1,97 @@
+/* coment */
+
+#if 1+1 < (-2*'a')
+wawa
+#elif 9<<1
+#define wow 3
+#else
+boop
+#endif
+
+#define NULL ((void *)0)
+int glob [ wow+wow];
+
+struct foo {
+ int x, y, z;
+};
+
+struct v2f { double x, y; };
+struct big { int x[10]; };
+
+struct v2f add(struct v2f a, struct v2f b, struct big B, struct { char c; } small, void *prt) {
+ struct v2f r;
+ r.y = a.y + b.y;
+ return r;
+}
+
+struct pair {
+ long x, y;
+};
+
+struct pair pair(long x, long y) {
+ struct pair p;
+ p.x = x;
+ p.y = y;
+ return p;
+}
+
+struct quad {
+ long x, y, z, w;
+};
+
+struct quad quad(long x, long y, long z, long w) {
+ struct quad q;
+ q.x = x, q.y = y, q.z = z, q.w = w;
+ return q;
+}
+
+void silly(struct pair *p, struct quad *q)
+{
+ *p = pair(1,2);
+ *q = quad(1,2,3,4);
+}
+
+void test2(struct big *b) {
+ struct big s = *b;
+ extern void h(int, struct big, float);
+ s.x[5] += 2;
+ h(0, s, 0);
+}
+
+struct f2 { float f,g; };
+struct f2 f2test(struct f2 *r) {
+ return *r;
+}
+
+void fill(char *p, int c, unsigned long n)
+{
+ int t;
+ if (n) do t = *p++ = c; while (--n);
+}
+
+void zero(void *p, unsigned long n) { fill(p,0,n); }
+
+enum ball {
+ neg = -1,
+ Zero,
+ Two = 2,
+ Three,
+ One = Zero + 1,
+ X = 2147483647,
+ Y,
+ Z,
+ W = ~0ull
+};
+enum ball x;
+
+_Bool t(int t)
+{
+ return t;
+}
+
+struct f{
+ union { int x,y;} ;
+ char flex[];
+};
+
+//
diff --git a/test/test2.c b/test/test2.c
new file mode 100644
index 0000000..7d39164
--- /dev/null
+++ b/test/test2.c
@@ -0,0 +1,23 @@
+typedef struct v2d { double x,y; } v2d;
+
+
+
+void addp(v2d *a, const v2d *b)
+{
+ a->x += b->x;
+ a->y += b->y;
+}
+
+v2d add(v2d a, v2d b)
+{
+ addp(&a, &b);
+ return a;
+}
+
+short s(int a, int b) {
+ return a + b;
+}
+
+int i() {
+ return s(1,2);
+}