summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/math_assignment.c22
-rw-r--r--tests/static-1.c9
-rw-r--r--tests/static-2.c4
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/math_assignment.c b/tests/math_assignment.c
new file mode 100644
index 0000000..abc295e
--- /dev/null
+++ b/tests/math_assignment.c
@@ -0,0 +1,22 @@
+int positive_test() {
+ int x = 0;
+ x += 5;//5
+ x -= 2;//3
+ x *= 9;//27 0x1b
+ x /= 2;//13 0xd
+
+ x %= 7;//6
+ x |= 8;//14 0xe
+ x ^= 3;//13 0xd
+
+ x += 2 << 3;//13 + 16 = 29 0xd
+ x -= 4 >> 1;//29 - 2 = 27 0x1b
+ x &= 7;//3
+ x <<= 5;//96 0x60
+ x >>= 5;//3
+ return x;
+}
+
+int main(){
+ return positive_test();
+}
diff --git a/tests/static-1.c b/tests/static-1.c
new file mode 100644
index 0000000..cbdf07a
--- /dev/null
+++ b/tests/static-1.c
@@ -0,0 +1,9 @@
+// Files: static-1.c static-2.c
+// pp2cc should be able to compile two files with the same function defined,
+// but using static storage
+static int f() {
+ return 1;
+}
+int main() {
+ return f();
+}
diff --git a/tests/static-2.c b/tests/static-2.c
new file mode 100644
index 0000000..9a2aed4
--- /dev/null
+++ b/tests/static-2.c
@@ -0,0 +1,4 @@
+// Part of static-1.c
+static int f() {
+ return 2;
+}