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

Method ForInput

util/stream/input_ut.cpp:24–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23 template <typename FuncType>
24 void ForInput(const TStringBuf text, const FuncType& func) {
25 TFile tempFile(TFile::Temporary("input_ut"));
26 tempFile.Write(text.data(), text.size());
27 tempFile.FlushData();
28 tempFile.Seek(0, sSet);
29
30 TFileHandle tempFh(tempFile.GetHandle());
31 tempFh.Duplicate2Posix(0);
32 tempFh.Release();
33
34 func();
35 Cin.ReadAll();
36 dup2(StdInCopy_, 0);
37 clearerr(stdin);
38 }
39
40private:
41 int StdInCopy_;

Callers 1

Y_UNIT_TESTFunction · 0.80

Calls 11

funcFunction · 0.85
Duplicate2PosixMethod · 0.80
ReadAllMethod · 0.80
dup2Function · 0.50
WriteMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
FlushDataMethod · 0.45
SeekMethod · 0.45
GetHandleMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected