From 8f6fa9fbcf66b1558e2fe0cf982d440eb79fa503 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 10 Apr 2014 10:49:27 +0000 Subject: [PATCH] .autotest git-svn-id: svn://ultimatepp.org/upp/trunk@7214 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- autotest/BiVector/BiVector.cpp | 9 +++++++-- autotest/BiVector/BiVector.upp | 2 ++ autotest/Gzip/Gzip.cpp | 5 ++--- autotest/Gzip/Gzip.upp | 2 ++ autotest/Heap/Heap.cpp | 4 ++++ autotest/Heap/Heap.upp | 2 ++ autotest/InArray/InArray.cpp | 27 ++++++++++++++++++--------- autotest/Sort/Sort.cpp | 4 +++- 8 files changed, 40 insertions(+), 15 deletions(-) diff --git a/autotest/BiVector/BiVector.cpp b/autotest/BiVector/BiVector.cpp index 73b2ae076..14df7bfdc 100644 --- a/autotest/BiVector/BiVector.cpp +++ b/autotest/BiVector/BiVector.cpp @@ -5,11 +5,15 @@ using namespace Upp; #ifdef flagLONG #define N 100000000 #else -#define N 5000000 +#define N 3000000 #endif CONSOLE_APP_MAIN { + StdLogSetup(LOG_COUT|LOG_FILE); + + TimeStop tm; + Vector x; BiVector y; for(int i = 0; i < N; i++) { @@ -47,5 +51,6 @@ CONSOLE_APP_MAIN y.Clear(); } } - LOG("========== OK"); + + LOG("========== OK " << tm); } diff --git a/autotest/BiVector/BiVector.upp b/autotest/BiVector/BiVector.upp index 28b3343ac..5d12738c6 100644 --- a/autotest/BiVector/BiVector.upp +++ b/autotest/BiVector/BiVector.upp @@ -1,3 +1,5 @@ +description "#WAIT: 20\377"; + uses Core; diff --git a/autotest/Gzip/Gzip.cpp b/autotest/Gzip/Gzip.cpp index 0bff45446..b787549a5 100644 --- a/autotest/Gzip/Gzip.cpp +++ b/autotest/Gzip/Gzip.cpp @@ -79,7 +79,7 @@ void Test2(int n, int fixed, int rndmask) CONSOLE_APP_MAIN { StdLogSetup(LOG_COUT|LOG_FILE); - + TimeStop tm; String gzf = LoadFile(GetHomeDirFile("mbox.gz")); Zlib z; z.GZip().Decompress(); @@ -99,6 +99,5 @@ CONSOLE_APP_MAIN Test(x, 0xffffffff, 100000, 2047); Test(x, 0xffffffff, 0, 2047); } - LOG("*************************************"); - LOG("EVERYTHING IS OK"); + LOG("===================== OK " << tm); } diff --git a/autotest/Gzip/Gzip.upp b/autotest/Gzip/Gzip.upp index c9f52c178..e93251fae 100644 --- a/autotest/Gzip/Gzip.upp +++ b/autotest/Gzip/Gzip.upp @@ -1,3 +1,5 @@ +description "#WAIT: 20\377"; + uses Core; diff --git a/autotest/Heap/Heap.cpp b/autotest/Heap/Heap.cpp index 2b48422cf..bcaebf2b7 100644 --- a/autotest/Heap/Heap.cpp +++ b/autotest/Heap/Heap.cpp @@ -133,6 +133,8 @@ void HeapTest(int cnt, int N, bool chk) CONSOLE_APP_MAIN { StdLogSetup(LOG_FILE|LOG_COUT); + TimeStop tm; + LOG("Allocator test:"); HeapTest(256, 100000, true); LOG("Checked allocator test Passed"); @@ -140,4 +142,6 @@ CONSOLE_APP_MAIN LOG("Quick allocator test Passed"); HeapTest(8192, 100 * 1000000, false); LOG("Allocator test Passed"); + + LOG("============== OK " << tm); } diff --git a/autotest/Heap/Heap.upp b/autotest/Heap/Heap.upp index 46d6d1bb3..42a9580c2 100644 --- a/autotest/Heap/Heap.upp +++ b/autotest/Heap/Heap.upp @@ -1,3 +1,5 @@ +description "#WAIT: 20\377"; + uses Core; diff --git a/autotest/InArray/InArray.cpp b/autotest/InArray/InArray.cpp index aec205564..67ccd16fb 100644 --- a/autotest/InArray/InArray.cpp +++ b/autotest/InArray/InArray.cpp @@ -2,6 +2,12 @@ using namespace Upp; +#ifdef flagLONG +#define N 100 +#else +#define N 20 +#endif + template void Compare(C1& a, C2& b) { @@ -29,7 +35,7 @@ void InArrayTest() q.Insert(0) = 0; iv.Insert(1) = -1; q.Insert(1) = -1; - for(int j = 0; j < 10000; j++) { + for(int j = 0; j < 100 * N; j++) { if(j % 1000 == 0) LOG(j); int i = Random(iv.GetCount()); @@ -39,7 +45,7 @@ void InArrayTest() ASSERT(iv.End() - iv.Begin() == iv.GetCount()); } - for(int i = 0; i < 100; i++) { + for(int i = 0; i < N; i++) { int n = Random(100) + 20; InArray::Iterator it2, it = iv.Begin(); it += n; @@ -65,7 +71,7 @@ void TestUpperBound() { { InArray v; - for(int i = 0; i < 3000; i++) { + for(int i = 0; i < 30 * N; i++) { if(i % 1000 == 0) LOG(i); v.Insert(i) = i; @@ -76,7 +82,7 @@ void TestUpperBound() } { InArray v; - for(int i = 0; i < 3000; i++) { + for(int i = 0; i < 30 * N; i++) { if(i % 1000 == 0) LOG(i); for(int j = 0; j < 7; j++) @@ -92,7 +98,7 @@ void TestLowerBound() { { InArray v; - for(int i = 0; i < 3000; i++) { + for(int i = 0; i < 30 * N; i++) { if(i % 1000 == 0) LOG(i); v.Insert(i) = i; @@ -103,7 +109,7 @@ void TestLowerBound() } { InArray v; - for(int i = 0; i < 3000; i++) { + for(int i = 0; i < 30 * N; i++) { if(i % 1000 == 0) LOG(i); for(int j = 0; j < 7; j++) @@ -121,7 +127,7 @@ void SetTest() LOG(j); Vector va; InArray ia; - for(int i = 0; i < 1000; i++) { + for(int i = 0; i < 10 * N; i++) { int q = Random(100); int ii = FindUpperBound(va, q); va.Insert(ii) = q; @@ -145,7 +151,7 @@ void RemoveTest() q.Insert(0) = 0; iv.Insert(1) = -1; q.Insert(1) = -1; - for(int j = 0; j < 10000000; j++) { + for(int j = 0; j < 100000 * N; j++) { if(j % 1000 == 0) LOG(j); if(iv.GetCount() > 200 && Random(4) == 1) { @@ -169,7 +175,7 @@ void InsertNTest() SeedRandom(); Vector av; InArray iv; - for(int i = 0; i < 100000; i++) { + for(int i = 0; i < 1000 * N; i++) { if(i % 1000 == 0) LOG(i); if(av.GetCount() > 2000) { @@ -192,6 +198,7 @@ void InsertNTest() CONSOLE_APP_MAIN { StdLogSetup(LOG_FILE|LOG_COUT); + TimeStop tm; SeedRandom(); RemoveTest(); @@ -200,4 +207,6 @@ CONSOLE_APP_MAIN TestLowerBound(); TestUpperBound(); InArrayTest(); + + LOG("============== OK " << tm); } diff --git a/autotest/Sort/Sort.cpp b/autotest/Sort/Sort.cpp index 91de34a4f..5e9488a7b 100644 --- a/autotest/Sort/Sort.cpp +++ b/autotest/Sort/Sort.cpp @@ -35,7 +35,8 @@ void CheckSorted(C& data) CONSOLE_APP_MAIN { StdLogSetup(LOG_FILE|LOG_COUT); - for(;;) { + TimeStop tm; + while(tm.Seconds() < 150) { Vector data = GetIntData(); LOG("int " << data.GetCount()); Sort(data); @@ -55,4 +56,5 @@ CONSOLE_APP_MAIN CheckSorted(sdata); } } + LOG("============ OK " << tm); }