+ equals(f.IsOpen(), false);
+ equals(f.Failed(), false);
+
+ equals(f.Open(fname, FileFd::ReadOnly, compressor), true);
+ equalsNot(f.FileSize(), 0);
+ equals(f.IsOpen(), true);
+ equals(f.Failed(), false);
+
+ char readback[20];
+ {
+ char const * const expect = "This";
+ equals(f.Read(readback, strlen(expect)), true);
+ equals(f.Failed(), false);
+ equals(f.Eof(), false);
+ strequals(expect, readback);
+ equals(strlen(expect), f.Tell());
+ }
+ {
+ char const * const expect = "test!";
+ equals(f.Skip((test.size() - f.Tell()) - strlen(expect)), true);
+ equals(f.Read(readback, strlen(expect)), true);
+ equals(f.Failed(), false);
+ equals(f.Eof(), false);
+ strequals(expect, readback);
+ equals(test.size(), f.Tell());
+ }
+
+ equals(f.Seek(0), true);
+ equals(f.Read(readback, 20, true), true);
+ equals(f.Failed(), false);
+ equals(f.Eof(), true);
+ equals(test, readback);
+ equals(test.size(), strlen(readback));
+ equals(f.Size(), f.Tell());
+
+ equals(f.Seek(0), true);
+ f.ReadLine(readback, 20);
+ equals(f.Failed(), false);
+ equals(f.Eof(), true);
+ equals(test, readback);
+ equals(test.size(), strlen(readback));
+ equals(f.Size(), f.Tell());
+
+ f.Close();
+ equals(f.IsOpen(), false);
+ equals(f.Failed(), false);
+
+ // regression test for permission bug LP: #1304657