From 05e5e829cc6f63d6571874a3ec43638e74020439 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 21 May 2020 17:18:22 +0000 Subject: [PATCH] .autotest git-svn-id: svn://ultimatepp.org/upp/trunk@14487 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- autotest/CoreBlit/CoreBlit.cpp | 66 ++++++++++++++++++++++++++++++++++ autotest/CoreBlit/CoreBlit.upp | 9 +++++ 2 files changed, 75 insertions(+) create mode 100644 autotest/CoreBlit/CoreBlit.cpp create mode 100644 autotest/CoreBlit/CoreBlit.upp diff --git a/autotest/CoreBlit/CoreBlit.cpp b/autotest/CoreBlit/CoreBlit.cpp new file mode 100644 index 000000000..bdb081b12 --- /dev/null +++ b/autotest/CoreBlit/CoreBlit.cpp @@ -0,0 +1,66 @@ +#include + +using namespace Upp; + +template +void CheckCopy(FN copy) +{ + LOG("CheckCopy " << sizeof(T)); + Buffer 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 +void CheckFill(FN fill) +{ + LOG("CheckFill " << sizeof(T)); + Buffer 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(svo_memset); + CheckFill(memsetd); + + CheckCopy(svo_memcpy); + CheckCopy(memcpyd); + + LOG("============= OK"); +} diff --git a/autotest/CoreBlit/CoreBlit.upp b/autotest/CoreBlit/CoreBlit.upp new file mode 100644 index 000000000..48f5532dd --- /dev/null +++ b/autotest/CoreBlit/CoreBlit.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + CoreBlit.cpp; + +mainconfig + "" = ""; +