From ba2843883b613b3d7858e66cecefb84a51ea2291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 4 Apr 2010 18:48:51 +0200 Subject: [PATCH] Added TODO testcase for ticket #1169 (improve check: divsion by zero not detected when using the shift (>>) operator) --- test/testtokenize.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index be260d57b..1c3b1650a 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -99,6 +99,7 @@ private: TEST_CASE(simplifyKnownVariables19); TEST_CASE(simplifyKnownVariables20); TEST_CASE(simplifyKnownVariables21); + TEST_CASE(simplifyKnownVariables22); TEST_CASE(match1); @@ -1057,6 +1058,26 @@ private: simplifyKnownVariables(code)); } + void simplifyKnownVariables22() + { + // This testcase is related to ticket #1169 + const char code[] = "void foo()\n" + "{\n" + " int n = 10;\n" + " i = (n >> 1);\n" + "}\n"; + + // Wanted result - Ticket #1169 can probably be closed when this works + TODO_ASSERT_EQUALS( + "void foo ( ) { int n ; n = 10 ; i = ( 10 >> 1 ) ; }", + simplifyKnownVariables(code)); + + // Current result + ASSERT_EQUALS( + "void foo ( ) { int n ; n = 10 ; i = ( n >> 1 ) ; }", + simplifyKnownVariables(code)); + } + void match1() { // Match "%var% | %var%"