Skip to content

Commit

Permalink
s [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed May 15, 2024
1 parent 4098e00 commit d4b01df
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class TestSymbolDatabase : public TestFixture {
typetok = nullptr;
}

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

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

std::string testExprIdEqual(const char code[],
template<size_t size>
std::string testExprIdEqual(const char (&code)[size],
const std::string& expr1,
unsigned int exprline1,
const std::string& expr2,
Expand Down Expand Up @@ -2578,7 +2580,8 @@ class TestSymbolDatabase : public TestFixture {
}

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

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

void exprIds()
{
const char* code;

code = "int f(int a) {\n"
const char code[] = "int f(int a) {\n"
" return a +\n"
" a;\n"
"}\n";
Expand Down

0 comments on commit d4b01df

Please sign in to comment.