Skip to content

Commit

Permalink
made TestTokenizerCompileLimits not heavy at all (#6587)
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Jul 11, 2024
1 parent 223a9ad commit ba29f83
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8262,19 +8262,15 @@ class TestTokenizerCompileLimits : public TestFixture
}

void test() {
const char raw_code[] = "#define PTR1 (* (* (* (* (* (* (* (* (* (*\n"
"#define PTR2 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1 PTR1\n"
"#define PTR3 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2 PTR2\n"
"#define PTR4 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3 PTR3\n"
"#define PTR5 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4 PTR4\n"
"#define PTR6 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5 PTR5\n"
const char raw_code[] = "#define PTR1 (* (* (* (*\n"
"#define PTR2 PTR1 PTR1 PTR1 PTR1\n"
"#define PTR3 PTR2 PTR2 PTR2 PTR2\n"
"#define PTR4 PTR3 PTR3 PTR3 PTR3\n"
"\n"
"#define RBR1 ) ) ) ) ) ) ) ) ) )\n"
"#define RBR2 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1 RBR1\n"
"#define RBR3 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2 RBR2\n"
"#define RBR4 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3 RBR3\n"
"#define RBR5 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4 RBR4\n"
"#define RBR6 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5 RBR5\n"
"#define RBR1 ) ) ) )\n"
"#define RBR2 RBR1 RBR1 RBR1 RBR1\n"
"#define RBR3 RBR2 RBR2 RBR2 RBR2\n"
"#define RBR4 RBR3 RBR3 RBR3 RBR3\n"
"\n"
"int PTR4 q4_var RBR4 = 0;\n";

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

ASSERT_THROW_INTERNAL(tokenizeAndStringify(code), AST);
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify(code), AST, "maximum AST depth exceeded");
}
};

Expand Down

0 comments on commit ba29f83

Please sign in to comment.