diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2012-09-02 09:14:55 -0700 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2012-09-02 09:14:55 -0700 |
commit | 9cb4c8073edea87d52bd0cf88f2317ead353eec2 (patch) | |
tree | f8b92c1aaabb72d8736ffd420d6e2ef914f9e88a /tests | |
parent | f6eb5b0a5f70a471eadf3922ee175bbc059258c8 (diff) |
Fixing ZHandle, and adding a unit test for it.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-Handles.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-Handles.cc b/tests/test-Handles.cc index d2e2396..04c35fc 100644 --- a/tests/test-Handles.cc +++ b/tests/test-Handles.cc @@ -125,5 +125,35 @@ void MainTask::Do() { z->writeString("foobar\n"); } + { + IO<Input> i(new Input("tests/out.z")); + IO<ZStream> z(new ZStream(i)); + IO<BStream> s(new BStream(z)); + z->detach(); + s->detach(); + String f = s->readString(); + TAssert(f == "foobar"); + } + + { + IO<Input> i(new Input("tests/out.gz")); + IO<ZStream> z(new ZStream(i, Z_BEST_COMPRESSION, ZStream::GZIP)); + IO<BStream> s(new BStream(z)); + z->detach(); + s->detach(); + String f = s->readString(); + TAssert(f == "foobar"); + } + + { + IO<Input> i(new Input("tests/out.raw")); + IO<ZStream> z(new ZStream(i, Z_BEST_COMPRESSION, ZStream::RAW)); + IO<BStream> s(new BStream(z)); + z->detach(); + s->detach(); + String f = s->readString(); + TAssert(f == "foobar"); + } + Printer::log(M_STATUS, "Test::Handles passed."); } |