Skip to content

Commit ba29f83

Browse files
authored
made TestTokenizerCompileLimits not heavy at all (cppcheck-opensource#6587)
1 parent 223a9ad commit ba29f83

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

test/testtokenize.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8262,19 +8262,15 @@ class TestTokenizerCompileLimits : public TestFixture
82628262
}
82638263

82648264
void test() {
8265-
const char raw_code[] = "#define PTR1 (* (* (* (* (* (* (* (* (* (*\n"
8266-
"#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1\n"
8267-
"#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2\n"
8268-
"#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3\n"
8269-
"#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4\n"
8270-
"#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5\n"
8265+
const char raw_code[] = "#define PTR1 (* (* (* (*\n"
8266+
"#define PTR2 PTR1 PTR1 PTR1 PTR1\n"
8267+
"#define PTR3 PTR2 PTR2 PTR2 PTR2\n"
8268+
"#define PTR4 PTR3 PTR3 PTR3 PTR3\n"
82718269
"\n"
8272-
"#define RBR1 ) ) ) ) ) ) ) ) ) )\n"
8273-
"#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1\n"
8274-
"#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2\n"
8275-
"#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3\n"
8276-
"#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4\n"
8277-
"#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5\n"
8270+
"#define RBR1 ) ) ) )\n"
8271+
"#define RBR2 RBR1 RBR1 RBR1 RBR1\n"
8272+
"#define RBR3 RBR2 RBR2 RBR2 RBR2\n"
8273+
"#define RBR4 RBR3 RBR3 RBR3 RBR3\n"
82788274
"\n"
82798275
"int PTR4 q4_var RBR4 = 0;\n";
82808276

@@ -8287,7 +8283,7 @@ class TestTokenizerCompileLimits : public TestFixture
82878283
const Settings settings;
82888284
const std::string code = PreprocessorHelper::getcode(settings, *this, filedata, emptyString, emptyString);
82898285

8290-
ASSERT_THROW_INTERNAL(tokenizeAndStringify(code), AST);
8286+
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify(code), AST, "maximum AST depth exceeded");
82918287
}
82928288
};
82938289

0 commit comments

Comments
 (0)