.upptst: StringStream unit test, FileOutLocking test

git-svn-id: svn://ultimatepp.org/upp/trunk@4639 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-03-02 12:01:15 +00:00
parent 800975614e
commit de75174143
6 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,18 @@
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
for(;;) {
Cout() << "Press ENTER to open FileOut\n";
ReadStdIn();
FileOut out(ConfigFile("testfile"));
if(out) {
Cout() << "file opened\nPress ENTER to close\n";
ReadStdIn();
}
else
Cout() << "NOT opened\n";
}
}

View file

@ -0,0 +1,11 @@
description "Testing the locking of FileOut\377";
uses
Core;
file
FileOutLocking.cpp;
mainconfig
"" = "SSE2";

View file

@ -0,0 +1,4 @@
#ifndef _FileOutLocking_icpp_init_stub
#define _FileOutLocking_icpp_init_stub
#include "Core/init"
#endif

View 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());
}
}

View file

@ -0,0 +1,11 @@
description "String stream unit testing\377";
uses
Core;
file
StringStream.cpp;
mainconfig
"" = "SSE2";

4
upptst/StringStream/init Normal file
View file

@ -0,0 +1,4 @@
#ifndef _StringStream_icpp_init_stub
#define _StringStream_icpp_init_stub
#include "Core/init"
#endif