diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 5d26d79f7..3fb5b9170 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -93,6 +93,7 @@ private: TEST_CASE(varid1); TEST_CASE(varid2); TEST_CASE(varid3); + // TODO TEST_CASE(varid4); // There is currently a problem for "*(a+10)" => "a[10]" TEST_CASE(file1); TEST_CASE(file2); @@ -729,6 +730,31 @@ private: ASSERT_EQUALS(expected, actual); } + void varid4() + { + const std::string code("void f(const unsigned int a[])\n" + "{\n" + " int i = *(a+10);\n" + "}\n"); + + // tokenize.. + Tokenizer tokenizer; + std::istringstream istr(code); + tokenizer.tokenize(istr, "test.cpp"); + tokenizer.setVarId(); + tokenizer.simplifyTokenList(); + + // result.. + const std::string actual(tokenizer.tokens()->stringifyList(true)); + const std::string expected("\n" + "1: void f ( const int a@1 [ ] )\n" + "2: {\n" + "3: int i@2 ; i@2 = a@1 [ 10 ] ;\n" + "4: }\n"); + + ASSERT_EQUALS(expected, actual); + } + void file1() {