summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/std/io.toc9
-rw-r--r--tests/test.bat4
-rwxr-xr-xtests/test.sh2
-rw-r--r--tests/tests.c (renamed from tests/test.c)2
5 files changed, 15 insertions, 4 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 33ccc5b..9c57a91 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -2,5 +2,5 @@ got
out.c
a.out
*.exe
-test
+tests
*.core
diff --git a/tests/std/io.toc b/tests/std/io.toc
index 9fa7e08..2b9e999 100644
--- a/tests/std/io.toc
+++ b/tests/std/io.toc
@@ -51,3 +51,12 @@ puti ::= fn(x: int) {
toc_putchar('\n');
}
+printf ::= #foreign("printf", base.libc) fn (#C &"const char", #C ..) #C int;
+writef ::= fn(x: float) {
+ fmt := "%f\0";
+ printf(&fmt[0], x);
+}
+putf ::= fn(x: float) {
+ writef(x);
+ toc_putchar('\n');
+}
diff --git a/tests/test.bat b/tests/test.bat
index b8156ad..1acfe32 100644
--- a/tests/test.bat
+++ b/tests/test.bat
@@ -1,5 +1,5 @@
@echo off
pushd "%~dp0"
-cl /nologo test.c
-test
+cl /nologo tests.c
+tests.exe
popd
diff --git a/tests/test.sh b/tests/test.sh
index ce7b294..779fafe 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -1,4 +1,4 @@
#!/bin/sh
cd $(dirname $0)
-cc test.c -o test -Wall -Wconversion -Wshadow -Werror && ./test
+cc tests.c -o tests -Wall -Wconversion -Wshadow -Werror && ./tests || exit 1
cd - >/dev/null
diff --git a/tests/test.c b/tests/tests.c
index 0593c9d..57f611e 100644
--- a/tests/test.c
+++ b/tests/tests.c
@@ -96,6 +96,8 @@ int main(int argc, char **argv) {
}
for (c = 0; c < ncompilers; ++c) {
const char *compiler = str_dup(compilers[c]);
+ if (strcmp(test, "sizeof") == 0 && strncmp(compiler, "tcc", 3) == 0)
+ continue; /* i think some versions of tcc have _Alignof but some don't */
char *p = strchr(compiler, ' ');
if (p) *p = 0;
printf("on %s... ", compiler);