diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-26 17:23:00 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-26 17:23:00 +0100 |
commit | e9657092063e786a52fefcfa4c528bac07472908 (patch) | |
tree | 01ac8abdc1ad5af82b0e48f163cd1e2b7cadced0 /test_deliverable | |
parent | dec9dc403e540ef4424debfdd866c73ca93adc83 (diff) | |
download | Compiler-e9657092063e786a52fefcfa4c528bac07472908.tar.gz Compiler-e9657092063e786a52fefcfa4c528bac07472908.zip |
working printf and added ellipsis
Diffstat (limited to 'test_deliverable')
-rwxr-xr-x | test_deliverable/c_compiler_ref.sh | 2 | ||||
-rw-r--r-- | test_deliverable/testcases/test_MAINSHARR.c | 8 | ||||
-rw-r--r-- | test_deliverable/testcases/test_MAINSHARR_driver.c | 10 | ||||
-rw-r--r-- | test_deliverable/testcases/test_PRINTF.c | 6 | ||||
-rw-r--r-- | test_deliverable/testcases/test_PRINTF_driver.c | 8 | ||||
-rw-r--r-- | test_deliverable/testcases/test_SHORTARRAY.c | 10 | ||||
-rw-r--r-- | test_deliverable/testcases/test_SHORTARRAY_driver.c | 7 |
7 files changed, 50 insertions, 1 deletions
diff --git a/test_deliverable/c_compiler_ref.sh b/test_deliverable/c_compiler_ref.sh index a55b56d..7fe89e8 100755 --- a/test_deliverable/c_compiler_ref.sh +++ b/test_deliverable/c_compiler_ref.sh @@ -1,4 +1,4 @@ #!/bin/bash -mips-linux-gnu-gcc -c -S -x c - -o - +mips-linux-gnu-gcc -std=c89 -c -S -x c - -o - exit $? diff --git a/test_deliverable/testcases/test_MAINSHARR.c b/test_deliverable/testcases/test_MAINSHARR.c new file mode 100644 index 0000000..bbf9ba0 --- /dev/null +++ b/test_deliverable/testcases/test_MAINSHARR.c @@ -0,0 +1,8 @@ +short *shortarray(short int *array, short a, short int b, short signed int c, short d, short e); + +int main() +{ + short signed int array[5] = {4, 23, 5, 6, 2}; + short *arr = shortarray(array, 39, 59, 145, 23, 329); + return !( 329 == arr[3] ); +} diff --git a/test_deliverable/testcases/test_MAINSHARR_driver.c b/test_deliverable/testcases/test_MAINSHARR_driver.c new file mode 100644 index 0000000..af2929a --- /dev/null +++ b/test_deliverable/testcases/test_MAINSHARR_driver.c @@ -0,0 +1,10 @@ +short *shortarray(short int *array, short a, short int b, short signed int c, short d, short e) +{ + array[4] = a; + array[0] = b; + array[2] = c; + array[1] = d; + array[3] = e; + + return array; +} diff --git a/test_deliverable/testcases/test_PRINTF.c b/test_deliverable/testcases/test_PRINTF.c new file mode 100644 index 0000000..9c4e005 --- /dev/null +++ b/test_deliverable/testcases/test_PRINTF.c @@ -0,0 +1,6 @@ +int printf(const char *format, ...); + +int printf_(const char *format) +{ + return printf(format); +} diff --git a/test_deliverable/testcases/test_PRINTF_driver.c b/test_deliverable/testcases/test_PRINTF_driver.c new file mode 100644 index 0000000..9de1039 --- /dev/null +++ b/test_deliverable/testcases/test_PRINTF_driver.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int printf_(const char *); + +int main() +{ + printf_("Hello World!: "); +} diff --git a/test_deliverable/testcases/test_SHORTARRAY.c b/test_deliverable/testcases/test_SHORTARRAY.c new file mode 100644 index 0000000..af2929a --- /dev/null +++ b/test_deliverable/testcases/test_SHORTARRAY.c @@ -0,0 +1,10 @@ +short *shortarray(short int *array, short a, short int b, short signed int c, short d, short e) +{ + array[4] = a; + array[0] = b; + array[2] = c; + array[1] = d; + array[3] = e; + + return array; +} diff --git a/test_deliverable/testcases/test_SHORTARRAY_driver.c b/test_deliverable/testcases/test_SHORTARRAY_driver.c new file mode 100644 index 0000000..d9a35e4 --- /dev/null +++ b/test_deliverable/testcases/test_SHORTARRAY_driver.c @@ -0,0 +1,7 @@ +short *shortarray(short int *array, short a, short int b, short signed int c, short d, short e); + +int main() +{ + short signed int array[5] = {4, 23, 5, 6, 2}; + return !( 324 == shortarray(array, 39, 59, 145, 23, 324)[3] ); +} |