From 0cfdc224aabcefdad5aedb46d26dcd977545881b Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 4 Apr 2014 17:12:41 +0000 Subject: [PATCH] .autotests git-svn-id: svn://ultimatepp.org/upp/trunk@7164 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- autotest/NanoStrings/NanoStrings.cpp | 6 ++++-- autotest/Stream64PutGet/Stream64PutGet.cpp | 2 ++ autotest/Stream64PutGet/Stream64PutGet.upp | 2 ++ autotest/StringFind/StringFind.cpp | 24 +++++++++++----------- autotest/StringStream/StringStream.cpp | 12 ++++------- autotest/XmlStream/3.xml | 14 +++++++++++++ autotest/XmlStream/XmlStream.cpp | 5 ++++- autotest/XmlStream/XmlStream.upp | 3 ++- 8 files changed, 44 insertions(+), 24 deletions(-) create mode 100644 autotest/XmlStream/3.xml diff --git a/autotest/NanoStrings/NanoStrings.cpp b/autotest/NanoStrings/NanoStrings.cpp index 67bdd5eb0..533b90a09 100644 --- a/autotest/NanoStrings/NanoStrings.cpp +++ b/autotest/NanoStrings/NanoStrings.cpp @@ -30,8 +30,10 @@ CONSOLE_APP_MAIN ns.ZeroTerminated(sz); SeedRandom(); - for(int i = 0; i < 140000000; i++) { - if(i % 10000000 == 0) + int i = 0; + int time0 = msecs(); + while(msecs(time0) < 20000) { + if(++i % 10000000 == 0) RLOG("Created " << i); String s = pass ? "x" : RandomString(Random(4) ? 5 : 50); ws.Add(ns.Add(s)); diff --git a/autotest/Stream64PutGet/Stream64PutGet.cpp b/autotest/Stream64PutGet/Stream64PutGet.cpp index d274deb4c..99a78f94a 100644 --- a/autotest/Stream64PutGet/Stream64PutGet.cpp +++ b/autotest/Stream64PutGet/Stream64PutGet.cpp @@ -17,6 +17,7 @@ CONSOLE_APP_MAIN out.Put64(big, sz); LOG("Saved"); } + ASSERT(GetFileLength(path) == sz); { FileIn in(path); for(int64 i = 0; i < sz; i++) @@ -31,5 +32,6 @@ CONSOLE_APP_MAIN for(int64 i = 0; i < sz; i++) ASSERT(big[i] == i % 123); } + DeleteFile(path); LOG("Test passed OK"); } diff --git a/autotest/Stream64PutGet/Stream64PutGet.upp b/autotest/Stream64PutGet/Stream64PutGet.upp index 704badf30..65bf11b04 100644 --- a/autotest/Stream64PutGet/Stream64PutGet.upp +++ b/autotest/Stream64PutGet/Stream64PutGet.upp @@ -1,3 +1,5 @@ +description "#WAIT: 20\377"; + uses Core; diff --git a/autotest/StringFind/StringFind.cpp b/autotest/StringFind/StringFind.cpp index c1e90d03b..4bbc872c3 100644 --- a/autotest/StringFind/StringFind.cpp +++ b/autotest/StringFind/StringFind.cpp @@ -30,18 +30,18 @@ void Check(T haystack, T needle, int pos) template void Check() { - - for(int l = 0; l < 30; l++) { - for(int r = 0; r < 30; r++) { - LOG(l << ":" << r); - for(int nl = 0; nl < 30; nl++) - for(int nr = 0; nr < 30; nr++) - for(int nc = 1; nc < 30; nc++) { - T needle = T('a', nl) + T('x', nc) + T('a', nr); - Check(T('a', l) + needle + T('a', r), needle, l); - Check(T('b', l) + needle + T('c', r), needle, l); - } - } + int time0 = msecs(); + while(msecs(time0) < 60000) { + int l = Random(40); + int r = Random(40); + LOG(l << ":" << r); + for(int nl = 0; nl < 30; nl++) + for(int nr = 0; nr < 30; nr++) + for(int nc = 1; nc < 30; nc++) { + T needle = T('a', nl) + T('x', nc) + T('a', nr); + Check(T('a', l) + needle + T('a', r), needle, l); + Check(T('b', l) + needle + T('c', r), needle, l); + } } ASSERT(T("test").Find("x") < 0); diff --git a/autotest/StringStream/StringStream.cpp b/autotest/StringStream/StringStream.cpp index ff3679c66..d8a66fad4 100644 --- a/autotest/StringStream/StringStream.cpp +++ b/autotest/StringStream/StringStream.cpp @@ -2,12 +2,6 @@ using namespace Upp; -#ifdef flagLONG -#define N 100000000 -#else -#define N 1000000 -#endif - String RandomString(int n) { String h; @@ -20,8 +14,10 @@ CONSOLE_APP_MAIN { StringStream ss; String es; - for(int i = 0; i < 100000000; i++) { - if(i % 10000 == 0) + int time0 = msecs(); + int i = 0; + while(msecs(time0) < 150000) { + if(++i % 10000 == 0) Cout() << i << "\r\n"; int p = Random(1000); String h = RandomString(p); diff --git a/autotest/XmlStream/3.xml b/autotest/XmlStream/3.xml new file mode 100644 index 000000000..c4938687e --- /dev/null +++ b/autotest/XmlStream/3.xml @@ -0,0 +1,14 @@ + + + +551 + + 201 + + + + %1 '%13' @CH:%2 @CLASS:%3/%4 @N:%23 @PRG:%24 @FILE:%25 @V1:%14 @V2:%15 @V3:%16 @V4:%17 @V5:%18 @K1:%19 @K2:%20 @K3:%21 @K4:%22 @TYPE:%12 @PATH:%29 @FOFFS:%26 @BOFFS:%27 @TOFFS:%28 @PINFO:%30 @MODUL:%5 @LINE:%6 @MID:%7 @BF:%8 @COM:%9 @VER:%11 @TIME:%10 + + + + diff --git a/autotest/XmlStream/XmlStream.cpp b/autotest/XmlStream/XmlStream.cpp index 6b2fdc916..6844a8064 100644 --- a/autotest/XmlStream/XmlStream.cpp +++ b/autotest/XmlStream/XmlStream.cpp @@ -73,9 +73,12 @@ CONSOLE_APP_MAIN LOG("----- Fixed files OK"); + return; SeedRandom(); - for(int i = 0; i < 100; i++) { + int time0 = msecs(); + + while(msecs(time0) < 150000) { LOG("* " << i); XmlNode n; XmlNode& nn = n.Add(); diff --git a/autotest/XmlStream/XmlStream.upp b/autotest/XmlStream/XmlStream.upp index 12dc3f593..b237b2b06 100644 --- a/autotest/XmlStream/XmlStream.upp +++ b/autotest/XmlStream/XmlStream.upp @@ -5,7 +5,8 @@ file XmlStream.cpp, 0.xml, 1.xml, - 2.xml; + 2.xml, + 3.xml; mainconfig "" = "SSE2 TEST_XML";