From 56fdab2ff0caaaa88a152ef06aef821f432fe488 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Wed, 8 Jan 2014 22:54:39 +0100 Subject: Added args1 and args2 test. --- tests/exec/args1.cpp | 13 +++++++++++++ tests/exec/args1.out | 2 ++ tests/exec/args2.cpp | 15 +++++++++++++++ tests/exec/args2.out | 2 ++ 4 files changed, 32 insertions(+) create mode 100644 tests/exec/args1.cpp create mode 100644 tests/exec/args1.out create mode 100644 tests/exec/args2.cpp create mode 100644 tests/exec/args2.out diff --git a/tests/exec/args1.cpp b/tests/exec/args1.cpp new file mode 100644 index 0000000..52edd82 --- /dev/null +++ b/tests/exec/args1.cpp @@ -0,0 +1,13 @@ +#include + +int f(int a, int b, int c, int d, int e, int f) { + std::cout << "a = " << a << ", b = " << b << + ", c = " << c << ", d = " << d << ", e = " << + e << ", f = " << f << "\n"; + return a + b + c + d + e + f; +} + +int main() { + int x = f(1, 2, 3, 4, 5, 6); + std::cout << "x = " << x << "\n"; +} diff --git a/tests/exec/args1.out b/tests/exec/args1.out new file mode 100644 index 0000000..34f8b2d --- /dev/null +++ b/tests/exec/args1.out @@ -0,0 +1,2 @@ +a = 1, b = 2, c = 3, d = 4, e = 5, f = 6 +x = 21 diff --git a/tests/exec/args2.cpp b/tests/exec/args2.cpp new file mode 100644 index 0000000..1d2efee --- /dev/null +++ b/tests/exec/args2.cpp @@ -0,0 +1,15 @@ +#include + +int test(int a) { + int *b = &a; + *b = *b + 42; + return a; +} + +int main() { + int x = 0; + int y = test(x); + std::cout << "x = " << x << "\n"; + std::cout << "y = " << y << "\n"; +} + diff --git a/tests/exec/args2.out b/tests/exec/args2.out new file mode 100644 index 0000000..7921196 --- /dev/null +++ b/tests/exec/args2.out @@ -0,0 +1,2 @@ +x = 0 +y = 42 -- cgit v1.2.3