From d2db4d3a27f8ae21c8d9507a5bc0d96565e96fdc Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Thu, 12 Nov 2009 21:04:11 +0200 Subject: [PATCH] Test case for #903 (segmentation fault of cppcheck) http://sourceforge.net/apps/trac/cppcheck/ticket/903 --- test/testsimplifytokens.cpp | 7 +++++++ test/testtokenize.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index c4343350e..641c372c7 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -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 = 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++])) { }")); } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index a4a54fb87..2154d534d 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -40,7 +40,7 @@ private: void run() { TEST_CASE(tokenize1); - + TEST_CASE(minus); TEST_CASE(longtok);