From 76ab3f1ddc143d65e97ab301c742ad6553f1b560 Mon Sep 17 00:00:00 2001 From: Nicolas 'Pixel' Noble Date: Sun, 20 Jan 2013 19:09:14 -0800 Subject: Adding open() as an operation to Input and Output. --- tests/test-Handles.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test-Handles.cc b/tests/test-Handles.cc index 847cb24..24e92aa 100644 --- a/tests/test-Handles.cc +++ b/tests/test-Handles.cc @@ -22,13 +22,15 @@ void MainTask::Do() { bool failed = false; try { - IO i(new Input("SomeInexistantFile.txt")); + IO i(new Input("SomeInexistantFile.txt")); + i->open(); } catch (ENoEnt e) { failed = true; } TAssert(failed); - IO i(new Input("tests/rtest.txt")); + IO i(new Input("tests/rtest.txt")); + i->open(); Printer::log(M_STATUS, "Opened file %s:", i->getName()); Printer::log(M_STATUS, " - size = %" PRIi64, i->getSize()); @@ -64,7 +66,8 @@ void MainTask::Do() { TAssert(r == (s - 5)); TAssert(memcmp(buf1, buf2, s) == 0); - IO o(new Output("tests/out.txt")); + IO o(new Output("tests/out.txt")); + o->open(); s = o->wtell(); TAssert(s == 0); s = o->getSize(); @@ -106,6 +109,7 @@ void MainTask::Do() { { IO o(new Output("tests/out.z")); + o->open(); IO z(new ZStream(o)); z->detach(); z->writeString("foobar\n"); @@ -113,6 +117,7 @@ void MainTask::Do() { { IO o(new Output("tests/out.gz")); + o->open(); IO z(new ZStream(o, Z_BEST_COMPRESSION, ZStream::GZIP)); z->detach(); z->writeString("foobar\n"); @@ -120,6 +125,7 @@ void MainTask::Do() { { IO o(new Output("tests/out.raw")); + o->open(); IO z(new ZStream(o, Z_BEST_COMPRESSION, ZStream::RAW)); z->detach(); z->writeString("foobar\n"); @@ -127,6 +133,7 @@ void MainTask::Do() { { IO i(new Input("tests/out.z")); + i->open(); IO z(new ZStream(i)); IO s(new BStream(z)); z->detach(); @@ -137,6 +144,7 @@ void MainTask::Do() { { IO i(new Input("tests/out.gz")); + i->open(); IO z(new ZStream(i, Z_BEST_COMPRESSION, ZStream::GZIP)); IO s(new BStream(z)); z->detach(); @@ -147,6 +155,7 @@ void MainTask::Do() { { IO i(new Input("tests/out.raw")); + i->open(); IO z(new ZStream(i, Z_BEST_COMPRESSION, ZStream::RAW)); IO s(new BStream(z)); z->detach(); -- cgit v1.2.3