mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-17 22:03:07 -06:00
Creating the *real* autotest nest
git-svn-id: svn://ultimatepp.org/upp/trunk@7141 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
dc9a464a45
commit
6d3aa8ba61
230 changed files with 9963 additions and 73 deletions
35
autotest/StringStream/StringStream.cpp
Normal file
35
autotest/StringStream/StringStream.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue