ultimatepp/autotest/StringStream/StringStream.cpp
cxl c9f34202b1 .autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@7159 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2014-04-03 18:39:30 +00:00

43 lines
663 B
C++

#include <Core/Core.h>
using namespace Upp;
#ifdef flagLONG
#define N 100000000
#else
#define N 1000000
#endif
String RandomString(int n)
{
String h;
while(n-- > 0)
h.Cat((byte)Random());
return h;
}
CONSOLE_APP_MAIN
{
StringStream ss;
String es;
for(int i = 0; i < 100000000; i++) {
if(i % 10000 == 0)
Cout() << i << "\r\n";
int p = Random(1000);
String h = RandomString(p);
ss.Put(h);
es.Cat(h);
if(Random(15) == 0) {
h = ss.GetResult();
ASSERT(h == es);
}
if(Random(15) == 0) {
ss.Create();
es.Clear();
}
// LOGHEXDUMP(es, es.GetCount());
}
LOG("========= OK");
}