From 6968fcd422803947777df4dfda8a5769543df545 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Mon, 26 Jan 2009 02:04:40 +0000 Subject: [PATCH] Added fix for bug. git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@949 7ec92016-0320-0410-acc4-a06ded1c099a --- test/flex_string/main.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/flex_string/main.cpp b/test/flex_string/main.cpp index 65dbafd..55a74f8 100644 --- a/test/flex_string/main.cpp +++ b/test/flex_string/main.cpp @@ -1003,6 +1003,32 @@ void Compare() */ } } + +/// This function tests out a bug found by Jean-Francois Bastien in the find function. +void TestBug2536490( void ) +{ + + my_string bug; + std::cout << "Index of '6' in \"" << bug.c_str() << "\": " << bug.find('6') << std::endl; + bug = "12345"; + std::cout << "Index of '6' in \"" << bug.c_str() << "\": " << bug.find('6') << std::endl; + bug = "123456"; + std::cout << "Index of '6' in \"" << bug.c_str() << "\": " << bug.find('6') << std::endl; + bug = "12345"; + std::cout << "Index of '6' in \"" << bug.c_str() << "\": " << bug.find('6') << std::endl; + + bug = "12345"; + std::cout << "Index of '123' in \"" << bug.c_str() << "\": " << bug.find("123") << std::endl; + bug = "12345"; + std::cout << "Index of '12345' in \"" << bug.c_str() << "\": " << bug.find("12345") << std::endl; + bug = "12345"; + std::cout << "Index of '345' in \"" << bug.c_str() << "\": " << bug.find("345") << std::endl; + bug = "123456"; + std::cout << "Index of '456' in \"" << bug.c_str() << "\": " << bug.find("456") << std::endl; + bug = "12345"; + std::cout << "Index of '456' in \"" << bug.c_str() << "\": " << bug.find("456") << std::endl; +} + /* #include #include @@ -1033,6 +1059,7 @@ int main() */ int main() { + TestBug2536490(); srand(unsigned(time(0))); Compare(); return 0;