mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.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:
parent
800975614e
commit
de75174143
6 changed files with 83 additions and 0 deletions
18
upptst/FileOutLocking/FileOutLocking.cpp
Normal file
18
upptst/FileOutLocking/FileOutLocking.cpp
Normal 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";
|
||||
}
|
||||
}
|
||||
11
upptst/FileOutLocking/FileOutLocking.upp
Normal file
11
upptst/FileOutLocking/FileOutLocking.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Testing the locking of FileOut\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
FileOutLocking.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2";
|
||||
|
||||
4
upptst/FileOutLocking/init
Normal file
4
upptst/FileOutLocking/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _FileOutLocking_icpp_init_stub
|
||||
#define _FileOutLocking_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
35
upptst/StringStream/StringStream.cpp
Normal file
35
upptst/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());
|
||||
}
|
||||
}
|
||||
11
upptst/StringStream/StringStream.upp
Normal file
11
upptst/StringStream/StringStream.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "String stream unit testing\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
StringStream.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2";
|
||||
|
||||
4
upptst/StringStream/init
Normal file
4
upptst/StringStream/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _StringStream_icpp_init_stub
|
||||
#define _StringStream_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue