summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/compile-c++11.sh3
-rwxr-xr-xtest/compile-c++20.sh4
-rwxr-xr-xtest/compile-c11.sh3
-rwxr-xr-xtest/compile-c99.sh3
-rwxr-xr-xtest/compile.sh3
-rw-r--r--test/inflate-app.c4
-rwxr-xr-xtest/test.sh18
7 files changed, 26 insertions, 12 deletions
diff --git a/test/compile-c++11.sh b/test/compile-c++11.sh
new file mode 100755
index 0000000..cb13625
--- /dev/null
+++ b/test/compile-c++11.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec g++ -std=c++11 -Wall -Wextra -pedantic -I../src -o inflate inflate-app.c ../src/inflate.c
diff --git a/test/compile-c++20.sh b/test/compile-c++20.sh
new file mode 100755
index 0000000..502063b
--- /dev/null
+++ b/test/compile-c++20.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# g++ as provided by Debian Buster (used for CI tests) does not support c++20
+exec g++ -std=c++2a -Wall -Wextra -pedantic -I../src -o inflate inflate-app.c ../src/inflate.c
diff --git a/test/compile-c11.sh b/test/compile-c11.sh
new file mode 100755
index 0000000..87ec632
--- /dev/null
+++ b/test/compile-c11.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec gcc -std=c11 -Wall -Wextra -pedantic -I../src -o inflate inflate-app.c ../src/inflate.c
diff --git a/test/compile-c99.sh b/test/compile-c99.sh
new file mode 100755
index 0000000..4583ebf
--- /dev/null
+++ b/test/compile-c99.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec gcc -std=c99 -Wall -Wextra -pedantic -I../src -o inflate inflate-app.c ../src/inflate.c
diff --git a/test/compile.sh b/test/compile.sh
deleted file mode 100755
index 3d6306f..0000000
--- a/test/compile.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec gcc -ggdb -Wall -Wextra -pedantic -I../src -o inflate inflate-app.c ../src/inflate.c
diff --git a/test/inflate-app.c b/test/inflate-app.c
index dddc807..988a3f1 100644
--- a/test/inflate-app.c
+++ b/test/inflate-app.c
@@ -9,8 +9,8 @@ unsigned char *outbuf;
int main(void)
{
// 16 MB
- inbuf = malloc(4096 * 4096);
- outbuf = malloc(4096 * 4096);
+ inbuf = (unsigned char*)malloc(4096 * 4096);
+ outbuf = (unsigned char*)malloc(4096 * 4096);
if (inbuf == NULL || outbuf == NULL) {
return 1;
diff --git a/test/test.sh b/test/test.sh
index dda32aa..44104d5 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -4,14 +4,18 @@ set -eu
cd "$(dirname "$0")"
-./compile.sh
+for std in c++11 c++20 c99 c11; do
+
+ "./compile-${std}.sh"
+
+ for file in $(find .. -type f -size -32760c); do
+ if ! ./deflate $file | ./inflate > tmp; then
+ echo "inflate error at $file"
+ ./deflate $file | ./inflate > tmp
+ fi
+ diff $file tmp
+ done
-for file in $(find .. -type f -size -32760c); do
- if ! ./deflate $file | ./inflate > tmp; then
- echo "inflate error at $file"
- ./deflate $file | ./inflate > tmp
- fi
- diff $file tmp
done
rm -f tmp