const correctness: added further testcases for increment/decrement member functions

This commit is contained in:
Ettl Martin 2010-12-30 02:05:44 +01:00
parent 7b92378c3a
commit ac42c0ba3b
1 changed files with 42 additions and 0 deletions

View File

@ -4867,6 +4867,48 @@ private:
" void nextA() { return ++a; }\n" " void nextA() { return ++a; }\n"
"};\n"); "};\n");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" int a;\n"
" void nextA() { return --a; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" int a;\n"
" void nextA() { return a++; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" int a;\n"
" void nextA() { return a--; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" int a;\n"
" void nextA() { return a-=1; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" int a;\n"
" void nextA() { return a+=1; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" int a;\n"
" void nextA() { return a*=-1; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
checkConst("class Fred {\n"
" int a;\n"
" void nextA() { return a/=-2; }\n"
"};\n");
ASSERT_EQUALS("", errout.str());
} }
// return pointer/reference => not const // return pointer/reference => not const