replace tabs

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@419 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2006-01-05 13:03:44 +00:00
parent c9fa59ada0
commit 727b519348

View file

@ -10,6 +10,8 @@
// without express or implied warranty.
////////////////////////////////////////////////////////////////////////////////
// $Header:
#ifdef _MSC_VER
#pragma warning (disable : 4786) // Get rid of browser information too long names
@ -105,10 +107,10 @@ String Test(String, unsigned int count, bool avoidAliasing)
{
test = RandomString(&test, maxString);
static unsigned int functionSelector = 0;
++functionSelector;
currentTest = functionSelector % 90;
//std::cout << currentTest <<"\n";
static unsigned int functionSelector = 0;
++functionSelector;
currentTest = functionSelector % 90;
//std::cout << currentTest <<"\n";
switch (currentTest)
{
case 0:
@ -215,23 +217,23 @@ String Test(String, unsigned int count, bool avoidAliasing)
break;
case 14:
// exercise empty
{
const char* kEmptyString = "empty";
const char* kNonEmptyString = "not empty";
if (test.empty()) test = "empty";
else test = "not empty";
// the above assignments don't work yet; use iterator assign
if (test.empty()) test = String(kEmptyString, kEmptyString + strlen(kEmptyString));
else test = String(kNonEmptyString, kNonEmptyString + strlen(kNonEmptyString));
}
{
const char* kEmptyString = "empty";
const char* kNonEmptyString = "not empty";
if (test.empty()) test = "empty";
else test = "not empty";
// the above assignments don't work yet; use iterator assign
if (test.empty()) test = String(kEmptyString, kEmptyString + strlen(kEmptyString));
else test = String(kNonEmptyString, kNonEmptyString + strlen(kNonEmptyString));
}
break;
case 15:
// exercise element access 21.3.4
if(!test.empty())
{
test[random(0, test.size() - 1)];
test.at(random(0, test.size() - 1));
}
{
test[random(0, test.size() - 1)];
test.at(random(0, test.size() - 1));
}
break;
case 16:
// 21.3.5 modifiers
@ -291,7 +293,7 @@ String Test(String, unsigned int count, bool avoidAliasing)
std::list<char> lst(RandomList(maxString));
test.append(lst.begin(), lst.end());
}
break;
break;
case 27:
// 21.3.5 modifiers
// skip push_back, Dinkumware doesn't support it
@ -382,7 +384,7 @@ String Test(String, unsigned int count, bool avoidAliasing)
case 42:
// 21.3.5 modifiers
if(!test.empty())
test.erase(test.begin() + random(0, test.size()));
test.erase(test.begin() + random(0, test.size()));
break;
case 43:
// 21.3.5 modifiers
@ -535,7 +537,7 @@ String Test(String, unsigned int count, bool avoidAliasing)
n = random(0, test.size() - pos);
typename String::iterator b = test.begin();
const String str = RandomString(&test, maxString);
const typename String::value_type* s = str.c_str();
const typename String::value_type* s = str.c_str();
test.replace(
b + pos,
b + pos + n,
@ -555,8 +557,8 @@ String Test(String, unsigned int count, bool avoidAliasing)
case 56:
// 21.3.5 modifiers
{
std::vector<typename String::value_type>
vec(random(0, maxString));
std::vector<typename String::value_type>
vec(random(0, maxString));
test.copy(
&vec[0],
vec.size(),
@ -866,16 +868,16 @@ template<class T>
void checkResults(const std::string& reference, const T& tested)
{
if( (tested.size() != reference.size())||
(std::string(tested.data(), tested.size()) != reference) )
{
std::cout << "\nTest " << currentTest << " failed: \n";
std::cout << "reference.size() = " << reference.size() << "\n";
std::cout << "tested.size() = " << tested.size() << "\n";
std::cout << "reference data = " << reference << "\n";
std::cout << "tested data = " << tested << "\n";
}
(std::string(tested.data(), tested.size()) != reference) )
{
std::cout << "\nTest " << currentTest << " failed: \n";
std::cout << "reference.size() = " << reference.size() << "\n";
std::cout << "tested.size() = " << tested.size() << "\n";
std::cout << "reference data = " << reference << "\n";
std::cout << "tested data = " << tested << "\n";
}
//assert(tested.size() == reference.size());
//assert(tested.size() == reference.size());
//assert(std::string(tested.data(), tested.size()) == reference);
}
@ -892,7 +894,7 @@ void Compare()
srand(t);
const std::string reference = Test(std::string(), 1, true);
{
{
srand(t);
typedef flex_string<
char,
@ -901,10 +903,10 @@ void Compare()
SimpleStringStorage<char, std::allocator<char> >
> my_string;
const my_string tested = Test(my_string(), 1, false);
checkResults(reference, tested);
checkResults(reference, tested);
}
{
{
srand(t);
typedef flex_string<
char,
@ -913,10 +915,10 @@ void Compare()
AllocatorStringStorage<char, std::allocator<char> >
> my_string;
const my_string tested = Test(my_string(), 1, false);
checkResults(reference, tested);
checkResults(reference, tested);
}
{
{
srand(t);
typedef flex_string<
char,
@ -925,10 +927,10 @@ void Compare()
AllocatorStringStorage<char, mallocator<char> >
> my_string;
const my_string tested = Test(my_string(), 1, false);
checkResults(reference, tested);
checkResults(reference, tested);
}
{
{
srand(t);
typedef flex_string<
char,
@ -937,9 +939,9 @@ void Compare()
VectorStringStorage<char, std::allocator<char> >
> my_string;
const my_string tested = Test(my_string(), 1, false);
checkResults(reference, tested);
checkResults(reference, tested);
}
{
{
srand(t);
typedef VectorStringStorage<char, std::allocator<char> >
Storage;
@ -951,7 +953,7 @@ void Compare()
> my_string;
static my_string sample;
const my_string tested(Test(sample, 1, false));
checkResults(reference, tested);
checkResults(reference, tested);
}
{
srand(t);
@ -965,7 +967,7 @@ void Compare()
> my_string;
static my_string sample;
const my_string tested(Test(sample, 1, false));
checkResults(reference, tested);
checkResults(reference, tested);
}
{
srand(t);
@ -979,12 +981,12 @@ void Compare()
> my_string;
static my_string sample;
const my_string tested(Test(sample, 1, false));
checkResults(reference, tested);
checkResults(reference, tested);
}
/*
{ // SimpleStringStorage with UTF16 Encoding
{ // SimpleStringStorage with UTF16 Encoding
srand(t);
typedef SimpleStringStorage<unicode::UTF16Char>
typedef SimpleStringStorage<unicode::UTF16Char>
Storage;
typedef flex_string<
unicode::UTF16Char,
@ -997,7 +999,7 @@ void Compare()
assert(tested.size() == reference.size());
//assert(std::string(tested.data(), tested.size()) == reference);
}
*/
*/
}
}
/*
@ -1022,10 +1024,10 @@ int main()
assert(std::numeric_limits<char_type>::is_specialized);
assert(std::numeric_limits<std_string_t::iterator::value_type>::is_specialized);
s1.replace<std_string_t::iterator>(s1.begin(), s1.begin(),
s2.begin(),s2.end());
return 0;
assert(std::numeric_limits<std_string_t::iterator::value_type>::is_specialized);
s1.replace<std_string_t::iterator>(s1.begin(), s1.begin(),
s2.begin(),s2.end());
return 0;
}
*/
int main()