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

Method TestStringStream

util/stream/ios_ut.cpp:88–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void TStreamsTest::TestStringStream() {
89 TStringStream s;
90
91 s << "qw\r\n1234"
92 << "\n"
93 << 34;
94
95 UNIT_ASSERT_EQUAL(s.ReadLine(), "qw");
96 UNIT_ASSERT_EQUAL(s.ReadLine(), "1234");
97
98 s << "\r\n"
99 << 123.1;
100
101 UNIT_ASSERT_EQUAL(s.ReadLine(), "34");
102 UNIT_ASSERT_EQUAL(s.ReadLine(), "123.1");
103
104 UNIT_ASSERT_EQUAL(s.Str(), "qw\r\n1234\n34\r\n123.1");
105
106 // Test stream copying
107 TStringStream sc = s;
108
109 s << "-666-" << 13;
110 sc << "-777-" << 0 << "JackPot";
111
112 UNIT_ASSERT_EQUAL(s.Str(), "qw\r\n1234\n34\r\n123.1-666-13");
113 UNIT_ASSERT_EQUAL(sc.Str(), "qw\r\n1234\n34\r\n123.1-777-0JackPot");
114
115 TStringStream ss;
116 ss = s;
117 s << "... and some trash";
118 UNIT_ASSERT_EQUAL(ss.Str(), "qw\r\n1234\n34\r\n123.1-666-13");
119}
120
121void TStreamsTest::TestGenericRead() {
122 TString s("1234567890");

Callers

nothing calls this directly

Calls 2

ReadLineMethod · 0.45
StrMethod · 0.45

Tested by

no test coverage detected