summaryrefslogtreecommitdiff
path: root/tests/test-Handles.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-10 23:09:53 -0700
committerPixel <pixel@nobis-crew.org>2011-10-10 23:31:07 -0700
commit67b6a78b347ab7ba269a52d772e79d12444f6e96 (patch)
tree5a105f61add7a5eaa8bd63a7182eecde84285b0e /tests/test-Handles.cc
parent8ae349b49e16064e4d84b6cfd256e3ca7fb0cd60 (diff)
Adding a few more features to Input, and actually creating a slightly better ClassName system, when using gcc and libstdc++.
Diffstat (limited to 'tests/test-Handles.cc')
-rw-r--r--tests/test-Handles.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/test-Handles.cc b/tests/test-Handles.cc
index 68d8baa..8c3c190 100644
--- a/tests/test-Handles.cc
+++ b/tests/test-Handles.cc
@@ -16,9 +16,10 @@ void MainTask::Do() {
failed = true;
}
Assert(failed);
- IO i(new Input("Makefile"));
+ IO i(new Input("tests/rtest.txt"));
Printer::log(M_STATUS, "Opened file %s:", i->getName());
Printer::log(M_STATUS, " - size = %lli", i->getSize());
+
char mtimestr[32];
time_t mtime = i->getMTime();
ctime_r(&mtime, mtimestr);
@@ -26,5 +27,18 @@ void MainTask::Do() {
if (nl)
*nl = 0;
Printer::log(M_STATUS, " - mtime = %i (%s)", mtime, mtimestr);
+
+ off_t s = i->rtell();
+ Assert(s == 0);
+
+ i->rseek(0, SEEK_END);
+ s = i->rtell();
+ Assert(s == i->getSize());
+
+ i->rseek(0, SEEK_SET);
+ char * buf = (char *) malloc(i->getSize());
+ ssize_t r = i->read(buf, s + 15);
+ Printer::log(M_STATUS, "Read %i bytes", r);
+
Printer::log(M_STATUS, "Test::Handles passed.");
}