From 727b519348ff43c13b854ebca221b8d849c22ce1 Mon Sep 17 00:00:00 2001 From: syntheticpp Date: Thu, 5 Jan 2006 13:03:44 +0000 Subject: [PATCH] replace tabs git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@419 7ec92016-0320-0410-acc4-a06ded1c099a --- test/flex_string/main.cpp | 102 +++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/test/flex_string/main.cpp b/test/flex_string/main.cpp index d5eae54..cf69be5 100755 --- a/test/flex_string/main.cpp +++ b/test/flex_string/main.cpp @@ -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 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 - vec(random(0, maxString)); + std::vector + vec(random(0, maxString)); test.copy( &vec[0], vec.size(), @@ -866,16 +868,16 @@ template 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 > > 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 > > 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 > > 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 > > my_string; const my_string tested = Test(my_string(), 1, false); - checkResults(reference, tested); + checkResults(reference, tested); } - { + { srand(t); typedef VectorStringStorage > 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 + typedef SimpleStringStorage 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::is_specialized); - assert(std::numeric_limits::is_specialized); - s1.replace(s1.begin(), s1.begin(), - s2.begin(),s2.end()); - return 0; + assert(std::numeric_limits::is_specialized); + s1.replace(s1.begin(), s1.begin(), + s2.begin(),s2.end()); + return 0; } */ int main()