mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
uppsrc: Crash moved to archive
git-svn-id: svn://ultimatepp.org/upp/trunk@15310 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4bc92b475f
commit
ff1c426cac
12 changed files with 646 additions and 601 deletions
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 974 B |
|
|
@ -49,12 +49,12 @@ CONSOLE_APP_MAIN
|
|||
{
|
||||
std::vector<std::string> d = c;
|
||||
RTIMING("CoSort<string>");
|
||||
CoSort(d.begin(), d.end(), StdLess<std::string>());
|
||||
CoSort(SubRange(d.begin(), d.end()), StdLess<std::string>());
|
||||
}
|
||||
{
|
||||
std::vector<std::string> d = c;
|
||||
RTIMING("Sort<string>");
|
||||
Sort(d.begin(), d.end(), StdLess<std::string>());
|
||||
Sort(SubRange(d.begin(), d.end()), StdLess<std::string>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
autotest/StringCompare3/StringCompare3.cpp
Normal file
35
autotest/StringCompare3/StringCompare3.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
int EtalonCompare(const String& sa, const String& sb)
|
||||
{
|
||||
int q = memcmp(~sa, ~sb, min(sa.GetLength(), sb.GetLength()));
|
||||
return q ? q : SgnCompare(sa.GetLength(), sb.GetLength());
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
int less = 0, equal = 0;
|
||||
for(int pass = 0; pass < 4; pass++) {
|
||||
LOG("======= Pass " << pass);
|
||||
for(int q = 0; q < 10000000; q++) {
|
||||
String x[2];
|
||||
for(int ii = 0; ii < 2; ii++) {
|
||||
int n = Random(pass & 1 ? 40 : 14);
|
||||
for(int i = 0; i < n; i++)
|
||||
x[ii].Cat(Random(pass & 2 ? Random(26) + 'A' : 2));
|
||||
}
|
||||
int r1 = EtalonCompare(x[0], x[1]);
|
||||
int r2 = x[0].Compare(x[1]);
|
||||
ASSERT(r1 == r2);
|
||||
if(r1 < 0)
|
||||
less++;
|
||||
if(r1 == 0)
|
||||
equal++;
|
||||
}
|
||||
LOG("Less: " << less << ", Equal: " << equal);
|
||||
}
|
||||
}
|
||||
9
autotest/StringCompare3/StringCompare3.upp
Normal file
9
autotest/StringCompare3/StringCompare3.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
StringCompare3.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
// http://isocpp.org/blog/2014/12/myths-3 6.1
|
||||
// http://isocpp.org/blog/2014/12/myths-3
|
||||
// section 6.1
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue