const correctness: added further testcases for increment/decrement member functions
This commit is contained in:
parent
7b92378c3a
commit
ac42c0ba3b
|
@ -4867,6 +4867,48 @@ private:
|
|||
" 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--; }\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
|
||||
|
|
Loading…
Reference in New Issue