MCPcopy Create free account
hub / github.com/PDAL/PDAL / TEST

Function TEST

test/unit/VSITest.cpp:45–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43using namespace pdal;
44
45TEST(VSITest, test_tells)
46{
47 int bufSize = 2;
48 Support::Tempfile temp(true);
49 std::string tmp = temp.filename();
50 EXPECT_TRUE(FileUtils::fileExists(tmp)==false);
51
52 // write test
53 VSI::VSIOStream* ostr = new VSI::VSIOStream(
54 tmp, std::ios::out | std::ios::binary, bufSize);
55
56 *ostr << "TEST";
57 EXPECT_EQ(ostr->tellp(), 4);
58 *ostr << "12345";
59 EXPECT_EQ(ostr->tellp(), 9);
60 delete ostr;
61
62 EXPECT_EQ(FileUtils::fileExists(tmp), true);
63 EXPECT_EQ(FileUtils::fileSize(tmp), 9U);
64
65 // read test
66 VSI::VSIIStream* istr = new VSI::VSIIStream(
67 tmp, std::ios::in | std::ios::binary, bufSize);
68 auto _ = istr->get();
69 EXPECT_EQ(istr->tellg(), 1);
70 char str[4];
71 istr->get(str, 4);
72 EXPECT_EQ(istr->tellg(), 4);
73 EXPECT_EQ(std::string(str), "EST");
74 std::string s;
75 *istr >> s;
76 EXPECT_EQ(s, "12345");
77 EXPECT_EQ(istr->tellg(), -1); // EoF
78 delete istr;
79}
80
81TEST(VSITest, test_seeks_small_buffer)
82{

Callers

nothing calls this directly

Calls 5

fileExistsFunction · 0.50
fileSizeFunction · 0.50
filenameMethod · 0.45
getMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected