diff options
author | Peter Wu <lekensteyn@gmail.com> | 2011-12-03 14:52:54 +0000 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2011-12-03 14:52:54 +0000 |
commit | 710bf8391d600b940b80f2dbd45e94cd0f447f74 (patch) | |
tree | f14e9e6dac53a56e7d7a610e060571053b6a6fbc /tests | |
parent | 4b297842f3b45c7857623c1c309654c339b28d85 (diff) | |
download | pp2cc-710bf8391d600b940b80f2dbd45e94cd0f447f74.tar.gz |
Add some tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/math_assignment.c | 22 | ||||
-rw-r--r-- | tests/static-1.c | 9 | ||||
-rw-r--r-- | tests/static-2.c | 4 |
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; +} |