mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@14487 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7e2a6f1d0c
commit
05e5e829cc
2 changed files with 75 additions and 0 deletions
66
autotest/CoreBlit/CoreBlit.cpp
Normal file
66
autotest/CoreBlit/CoreBlit.cpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
template <class T, class FN>
|
||||
void CheckCopy(FN copy)
|
||||
{
|
||||
LOG("CheckCopy " << sizeof(T));
|
||||
Buffer<T> b0(20000, 0), b1(20000, 0), b2(20000, 0);
|
||||
for(int pass = 0; pass < 4; pass++) {
|
||||
LOG(pass);
|
||||
for(int i = 0; i < 500000; i++) {
|
||||
int pos = Random(200);
|
||||
int len = Random(decode(pass, 0, 20, 1, 200, 2, 2000, 9999));
|
||||
memset(~b0 + pos, i, len * sizeof(T));
|
||||
pos = Random(200);
|
||||
len = Random(200);
|
||||
copy(~b1 + pos, ~b0 + pos, len);
|
||||
memcpy(~b2 + pos, ~b0 + pos, len * sizeof(T));
|
||||
if(memcmp(b1, b2, 20000)) {
|
||||
RDUMP(i);
|
||||
RDUMP(pos);
|
||||
RDUMP(len);
|
||||
Panic("Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class FN>
|
||||
void CheckFill(FN fill)
|
||||
{
|
||||
LOG("CheckFill " << sizeof(T));
|
||||
Buffer<T> b1(20000, 0), b2(20000, 0);
|
||||
for(int pass = 0; pass < 4; pass++) {
|
||||
LOG(pass);
|
||||
for(int i = 0; i < 500000; i++) {
|
||||
int pos = Random(200);
|
||||
int len = Random(decode(pass, 0, 20, 1, 200, 2, 2000, 9999));
|
||||
pos = Random(200);
|
||||
len = Random(200);
|
||||
fill(~b1 + pos, i, len);
|
||||
for(int j = 0; j < len; j++)
|
||||
b2[pos + j] = i;
|
||||
if(memcmp(b1, b2, 20000)) {
|
||||
RDUMP(i);
|
||||
RDUMP(pos);
|
||||
RDUMP(len);
|
||||
Panic("Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
CheckFill<byte>(svo_memset);
|
||||
CheckFill<dword>(memsetd);
|
||||
|
||||
CheckCopy<byte>(svo_memcpy);
|
||||
CheckCopy<dword>(memcpyd);
|
||||
|
||||
LOG("============= OK");
|
||||
}
|
||||
9
autotest/CoreBlit/CoreBlit.upp
Normal file
9
autotest/CoreBlit/CoreBlit.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
CoreBlit.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue