Bug fix: Minor bug in previous commit, test added to catch that bug also.

This commit is contained in:
Reijo Tomperi 2008-12-04 21:52:40 +00:00
parent c958482196
commit a4d4305919
2 changed files with 3 additions and 0 deletions

View File

@ -226,6 +226,7 @@ private:
// Test for not found
ASSERT_EQUALS( TOKEN::multiCompare( "one|two", "notfound" ), -1 );
ASSERT_EQUALS( TOKEN::multiCompare( "verybig|two", "s" ), -1 );
ASSERT_EQUALS( TOKEN::multiCompare( "one|two", "ne" ), -1 );
}
};

View File

@ -105,6 +105,8 @@ int TOKEN::multiCompare( const char *needle, const char *haystack )
continue;
}
else if( findNextOr )
continue;
// If this part of needle equals to the haystack
else if( strncmp( haystack, needle, strlen( haystack ) ) == 0 )