Skip to content

Commit

Permalink
test: add function test
Browse files Browse the repository at this point in the history
  • Loading branch information
diohabara committed Aug 2, 2023
1 parent 2c803ae commit f80b4e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ test: ccc
./ccc tests > tmp.s
echo 'int char_fn() { return 257; }' | gcc -xc -c -o tmp2.o -
echo 'int ext1 = 5; int *ext2 = &ext1;' | gcc -xc -c -o tmp3.o -
gcc -static -o tmp tmp.s tmp2.o tmp3.o
echo 'int ext_fn1(int x) { return x; }; int ext_fn2(int x) { return x;}' | gcc -xc -c -o tmp4.o -
gcc -static -o tmp tmp.s tmp2.o tmp3.o tmp4.o
./tmp

testx:
Expand Down
4 changes: 4 additions & 0 deletions tests
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ static int static_fn(void) {}

extern int ext1;
extern int *ext2;
int ext_fn1(int x);
extern int ext_fn2(int x);

int main() {
assert(8, ({
Expand Down Expand Up @@ -956,6 +958,8 @@ int main() {

assert(5, ext1, "ext1");
assert(5, *ext2, "*ext2");
assert(6, ext_fn1(6), "ext_fn1(6)");
assert(7, ext_fn2(7), "ext_fn2(7)");

printf("OK\n");
return 0;
Expand Down

0 comments on commit f80b4e7

Please sign in to comment.