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 + "" = ""; +