Test case for #903 (segmentation fault of cppcheck)

http://sourceforge.net/apps/trac/cppcheck/ticket/903
This commit is contained in:
Reijo Tomperi 2009-11-12 21:04:11 +02:00
parent b6cda12251
commit d2db4d3a27
2 changed files with 8 additions and 1 deletions

View File

@ -1444,6 +1444,13 @@ private:
{ {
ASSERT_EQUALS("; a = b ; while ( a ) { b = 0 ; a = b ; }", simplifyIfAssign(";while(a=b) { b = 0; }")); ASSERT_EQUALS("; a = b ; while ( a ) { b = 0 ; a = b ; }", simplifyIfAssign(";while(a=b) { b = 0; }"));
ASSERT_EQUALS("; a . b = c ; while ( a . b ) { c = 0 ; a . b = c ; }", simplifyIfAssign(";while(a.b=c) { c=0; }")); ASSERT_EQUALS("; a . b = c ; while ( a . b ) { c = 0 ; a . b = c ; }", simplifyIfAssign(";while(a.b=c) { c=0; }"));
ASSERT_EQUALS("struct hfs_bnode * node ; "
"struct hfs_btree * tree ; "
"node = tree . node_hash [ i ++ ] ; "
"while ( node ) { node = tree . node_hash [ i ++ ] ; }",
tok("struct hfs_bnode *node;"
"struct hfs_btree *tree;"
"while ((node = tree->node_hash[i++])) { }"));
} }

View File

@ -40,7 +40,7 @@ private:
void run() void run()
{ {
TEST_CASE(tokenize1); TEST_CASE(tokenize1);
TEST_CASE(minus); TEST_CASE(minus);
TEST_CASE(longtok); TEST_CASE(longtok);