Skip to content

Commit d4b01df

Browse files
committed
s [skip ci]
1 parent 4098e00 commit d4b01df

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/testsymboldatabase.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class TestSymbolDatabase : public TestFixture {
7474
typetok = nullptr;
7575
}
7676

77-
static const SymbolDatabase* getSymbolDB_inner(SimpleTokenizer& tokenizer, const char* code, bool cpp) {
77+
template<size_t size>
78+
static const SymbolDatabase* getSymbolDB_inner(SimpleTokenizer& tokenizer, const char (&code)[size], bool cpp) {
7879
return tokenizer.tokenize(code, cpp) ? tokenizer.getSymbolDatabase() : nullptr;
7980
}
8081

@@ -93,7 +94,8 @@ class TestSymbolDatabase : public TestFixture {
9394
return tok->expressionString() + "@" + std::to_string(tok->exprId());
9495
}
9596

96-
std::string testExprIdEqual(const char code[],
97+
template<size_t size>
98+
std::string testExprIdEqual(const char (&code)[size],
9799
const std::string& expr1,
98100
unsigned int exprline1,
99101
const std::string& expr2,
@@ -2578,7 +2580,8 @@ class TestSymbolDatabase : public TestFixture {
25782580
}
25792581

25802582
#define check(...) check_(__FILE__, __LINE__, __VA_ARGS__)
2581-
void check_(const char* file, int line, const char code[], bool debug = true, bool cpp = true, const Settings* pSettings = nullptr) {
2583+
template<size_t size>
2584+
void check_(const char* file, int line, const char (&code)[size], bool debug = true, bool cpp = true, const Settings* pSettings = nullptr) {
25822585
// Check..
25832586
const Settings settings = settingsBuilder(pSettings ? *pSettings : settings1).debugwarnings(debug).build();
25842587

@@ -8719,7 +8722,8 @@ class TestSymbolDatabase : public TestFixture {
87198722
}
87208723
}
87218724
#define typeOf(...) typeOf_(__FILE__, __LINE__, __VA_ARGS__)
8722-
std::string typeOf_(const char* file, int line, const char code[], const char pattern[], bool cpp = true, const Settings *settings = nullptr) {
8725+
template<size_t size>
8726+
std::string typeOf_(const char* file, int line, const char (&code)[size], const char pattern[], bool cpp = true, const Settings *settings = nullptr) {
87238727
SimpleTokenizer tokenizer(settings ? *settings : settings2, *this);
87248728
ASSERT_LOC(tokenizer.tokenize(code, cpp), file, line);
87258729
const Token* tok;
@@ -10367,9 +10371,7 @@ class TestSymbolDatabase : public TestFixture {
1036710371

1036810372
void exprIds()
1036910373
{
10370-
const char* code;
10371-
10372-
code = "int f(int a) {\n"
10374+
const char code[] = "int f(int a) {\n"
1037310375
" return a +\n"
1037410376
" a;\n"
1037510377
"}\n";

0 commit comments

Comments
 (0)