From 613ffd0d5832a131b99143ed1bd28824d563a572 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 15 Dec 2013 18:16:28 +0000 Subject: [PATCH] .upptst git-svn-id: svn://ultimatepp.org/upp/trunk@6655 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- upptst/FileSel/init | 4 +++ upptst/InVector/InVector.cpp | 2 +- upptst/ize/ize.cpp | 47 +++++++++++++++++++++++++----------- 3 files changed, 38 insertions(+), 15 deletions(-) create mode 100644 upptst/FileSel/init diff --git a/upptst/FileSel/init b/upptst/FileSel/init new file mode 100644 index 000000000..1967588ed --- /dev/null +++ b/upptst/FileSel/init @@ -0,0 +1,4 @@ +#ifndef _FileSel_icpp_init_stub +#define _FileSel_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/upptst/InVector/InVector.cpp b/upptst/InVector/InVector.cpp index a0607064c..4919a0eb2 100644 --- a/upptst/InVector/InVector.cpp +++ b/upptst/InVector/InVector.cpp @@ -62,7 +62,7 @@ void InVectorTest() for(int i = 0; i < 100; i++) { int n = Random(100) + 20; - InVector::Iterator it2, it = iv.Begin(); + typename InVector::Iterator it2, it = iv.Begin(); it += n; ASSERT(it - iv.Begin() == n); it2 = it; diff --git a/upptst/ize/ize.cpp b/upptst/ize/ize.cpp index 992a15fbd..bff2a40e9 100644 --- a/upptst/ize/ize.cpp +++ b/upptst/ize/ize.cpp @@ -4,11 +4,19 @@ using namespace Upp; template void Test(T& data) -{ +{ + LOG("-----------------"); T data2; + String bin = StoreAsString(data); + LoadFromString(data2, bin); + data2.Shrink(); + ASSERT(StoreAsJson(data) == StoreAsJson(data2)); + ASSERT(StoreAsString(data) == StoreAsString(data2)); + String xml = StoreAsXML(data); DUMP(xml); LoadFromXML(data2, xml); + data2.Shrink(); ASSERT(StoreAsJson(data) == StoreAsJson(data2)); ASSERT(StoreAsString(data) == StoreAsString(data2)); @@ -16,6 +24,7 @@ void Test(T& data) DUMP(json); data2.Clear(); LoadFromJson(data2, json); + data2.Shrink(); ASSERT(StoreAsXML(data) == StoreAsXML(data2)); ASSERT(StoreAsString(data) == StoreAsString(data2)); } @@ -46,30 +55,40 @@ void TestMap() CONSOLE_APP_MAIN { - Test< Vector >(); - Test< WithDeepCopy< Vector > >(); + StdLogSetup(LOG_FILE|LOG_COUT); + Test< Vector >(); Test< WithDeepCopy< Vector > >(); - Test< Array >(); - Test< WithDeepCopy< Array > >(); Test< Array >(); Test< WithDeepCopy< Array > >(); - Test< Index >(); - Test< WithDeepCopy< Index > >(); Test< Index >(); Test< WithDeepCopy< Index > >(); Test< ArrayIndex >(); Test< WithDeepCopy< ArrayIndex > >(); - Test< ArrayIndex >(); - Test< WithDeepCopy< ArrayIndex > >(); - - TestMap< VectorMap >(); - TestMap< WithDeepCopy< VectorMap > >(); - TestMap< VectorMap >(); - TestMap< WithDeepCopy< VectorMap > >(); + Test< InVector >(); + Test< WithDeepCopy > >(); + + Test< InArray >(); + Test< WithDeepCopy > >(); + + Test< SortedIndex >(); + Test< WithDeepCopy > >(); + + TestMap< VectorMap >(); + TestMap< WithDeepCopy< VectorMap > >(); + + TestMap< ArrayMap >(); + TestMap< WithDeepCopy< ArrayMap > >(); + + TestMap< SortedVectorMap >(); + TestMap< WithDeepCopy< SortedVectorMap > >(); + + TestMap< SortedArrayMap >(); + TestMap< WithDeepCopy< SortedArrayMap > >(); + LOG("========= EVERYTHING OK =========="); }