From 731ca6286443febfcbf22684dc96771acf8059de Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 18 Jun 2019 11:44:14 +0000 Subject: [PATCH] .autotest git-svn-id: svn://ultimatepp.org/upp/trunk@13415 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- .../ValueSortCompare/ValueSortCompare.cpp | 35 +++++++++++++++++++ .../ValueSortCompare/ValueSortCompare.upp | 9 +++++ 2 files changed, 44 insertions(+) create mode 100644 autotest/ValueSortCompare/ValueSortCompare.cpp create mode 100644 autotest/ValueSortCompare/ValueSortCompare.upp diff --git a/autotest/ValueSortCompare/ValueSortCompare.cpp b/autotest/ValueSortCompare/ValueSortCompare.cpp new file mode 100644 index 000000000..2a88e4cda --- /dev/null +++ b/autotest/ValueSortCompare/ValueSortCompare.cpp @@ -0,0 +1,35 @@ +#include + +using namespace Upp; + +void Test(Vector& h) +{ + Sort(h); + for(int i = 0; i < h.GetCount() - 1; i++) + ASSERT(h[i] <= h[i + 1]); +} + +CONSOLE_APP_MAIN +{ + StdLogSetup(LOG_COUT|LOG_FILE); + + Vector vi, vf, vd, vt, vi64, vs; + SeedRandom(0); + for(int i = 0; i < 10000; i++) { + vi.Add((int)Random()); + vf.Add(Randomf()); + vi64.Add((int64)Random64()); + vt.Add(GetSysTime() + (int64)Random64()); + vd.Add(GetSysDate() + Random()); + vs.Add(AsString(Random())); + } + + Test(vi); + Test(vf); + Test(vi64); + Test(vs); + Test(vd); + Test(vt); + + LOG("============ OK"); +} diff --git a/autotest/ValueSortCompare/ValueSortCompare.upp b/autotest/ValueSortCompare/ValueSortCompare.upp new file mode 100644 index 000000000..25e714cba --- /dev/null +++ b/autotest/ValueSortCompare/ValueSortCompare.upp @@ -0,0 +1,9 @@ +uses + Core; + +file + ValueSortCompare.cpp; + +mainconfig + "" = ""; +