alwaysTrueFalseStringCompare: Added more test cases to ensure no FP appears.

This commit is contained in:
orbitcowboy 2015-01-07 08:38:39 +01:00
parent cd98471398
commit 4c2e42a52c
1 changed files with 9 additions and 3 deletions

View File

@ -129,6 +129,8 @@ private:
check("void f(void *p, int offset) {\n"
" if (!memcmp(p, p + offset, 42)){}\n"
" if (!memcmp(p + offset, p, 42)){}\n"
" if (!memcmp(offset + p, p, 42)){}\n"
" if (!memcmp(p, offset + p, 42)){}\n"
"}\n");
ASSERT_EQUALS("", errout.str());
@ -136,6 +138,8 @@ private:
check("void f(char *c, int offset) {\n"
" if (!memcmp(c, c + offset, 42)){}\n"
" if (!memcmp(c + offset, c, 42)){}\n"
" if (!memcmp(offset + c, c, 42)){}\n"
" if (!memcmp(c, offset + c, 42)){}\n"
"}\n");
ASSERT_EQUALS("", errout.str());
@ -143,6 +147,8 @@ private:
check("void f(std::string s, int offset) {\n"
" if (!memcmp(s.c_str(), s.c_str() + offset, 42)){}\n"
" if (!memcmp(s.c_str() + offset, s.c_str(), 42)){}\n"
" if (!memcmp(offset + s.c_str(), s.c_str(), 42)){}\n"
" if (!memcmp(s.c_str(), offset + s.c_str(), 42)){}\n"
"}\n");
ASSERT_EQUALS("", errout.str());