MCPcopy Create free account
hub / github.com/catboost/catboost / TestStrings

Method TestStrings

library/cpp/on_disk/chunks/chunks_ut.cpp:202–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200 }
201
202 void TestStrings() {
203 const TString FILENAME = "chunked_helpers_test.bin";
204 TTempFileHandle file(FILENAME.c_str());
205
206 {
207 TFixedBufferFileOutput fOut(FILENAME);
208 TStringsVectorWriter stringsWriter;
209 stringsWriter.PushBack("");
210 stringsWriter.PushBack("test");
211 TChunkedDataWriter writer(fOut);
212 WriteBlock(writer, stringsWriter);
213 writer.WriteFooter();
214 }
215
216 {
217 TBlob fIn = TBlob::FromFileSingleThreaded(FILENAME);
218 TStringsVector vct(GetBlock(fIn, 0));
219 UNIT_ASSERT_EQUAL(vct.Get(0), "");
220 UNIT_ASSERT_EQUAL(vct.Get(1), "test");
221
222 bool wasException = false;
223 try {
224 vct.Get(2);
225 } catch (...) {
226 wasException = true;
227 }
228 UNIT_ASSERT(wasException);
229 }
230 }
231
232 void TestNamedChunkedData() {
233 const TString filename = MakeTempName(nullptr, "named_chunked_data_test");

Callers

nothing calls this directly

Calls 6

WriteBlockFunction · 0.85
GetBlockFunction · 0.85
c_strMethod · 0.45
PushBackMethod · 0.45
WriteFooterMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected