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

Method TestResize

util/system/file_ut.cpp:96–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 }
95
96 inline void TestResize() {
97 TTempFile tmp("tmp");
98
99 {
100 TFile file(tmp.Name(), OpenAlways | WrOnly);
101
102 file.Write("1234567", 7);
103 file.Seek(3, sSet);
104
105 file.Resize(5);
106 UNIT_ASSERT_EQUAL(file.GetLength(), 5);
107 UNIT_ASSERT_EQUAL(file.GetPosition(), 3);
108
109 file.Resize(12);
110 UNIT_ASSERT_EQUAL(file.GetLength(), 12);
111 UNIT_ASSERT_EQUAL(file.GetPosition(), 3);
112 }
113
114 const TString data = TUnbufferedFileInput(tmp.Name()).ReadAll();
115 UNIT_ASSERT_EQUAL(data.length(), 12);
116 UNIT_ASSERT(data.StartsWith("12345"));
117 }
118};
119
120UNIT_TEST_SUITE_REGISTRATION(TFileTest);

Callers

nothing calls this directly

Calls 10

ReadAllMethod · 0.80
NameMethod · 0.45
WriteMethod · 0.45
SeekMethod · 0.45
ResizeMethod · 0.45
GetLengthMethod · 0.45
GetPositionMethod · 0.45
lengthMethod · 0.45
StartsWithMethod · 0.45

Tested by

no test coverage detected