summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2012-02-28 00:05:31 -0800
committerPixel <pixel@nobis-crew.org>2012-02-28 00:05:31 -0800
commit81132947f2f70d4a4b7423d8b718b662bcefaef9 (patch)
treeee4c2b12ee8cb8881ef4cab4d21fa1a9ca4b7727
parent30c37eb549c17b29a8131598cc06aeaf374896f5 (diff)
Adding a short test for the ZStreams.
-rw-r--r--Makefile2
-rw-r--r--tests/test-Handles.cc22
2 files changed, 23 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3592bbc..35fd727 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ LDFLAGS += -g
endif
INCLUDES = includes libcoro libeio libev LuaJIT/src
-LIBS =
+LIBS = z
ifeq ($(SYSTEM),Darwin)
CC = clang
diff --git a/tests/test-Handles.cc b/tests/test-Handles.cc
index c872e9f..d2e2396 100644
--- a/tests/test-Handles.cc
+++ b/tests/test-Handles.cc
@@ -3,6 +3,7 @@
#include <Output.h>
#include <Buffer.h>
#include <BStream.h>
+#include <ZHandle.h>
#ifdef _WIN32
void ctime_r(const time_t * t, char * str) {
@@ -103,5 +104,26 @@ void MainTask::Do() {
TAssert(s == 12);
TAssert(b->isEOF());
+ {
+ IO<Output> o(new Output("tests/out.z"));
+ IO<ZStream> z(new ZStream(o));
+ z->detach();
+ z->writeString("foobar\n");
+ }
+
+ {
+ IO<Output> o(new Output("tests/out.gz"));
+ IO<ZStream> z(new ZStream(o, Z_BEST_COMPRESSION, ZStream::GZIP));
+ z->detach();
+ z->writeString("foobar\n");
+ }
+
+ {
+ IO<Output> o(new Output("tests/out.raw"));
+ IO<ZStream> z(new ZStream(o, Z_BEST_COMPRESSION, ZStream::RAW));
+ z->detach();
+ z->writeString("foobar\n");
+ }
+
Printer::log(M_STATUS, "Test::Handles passed.");
}