Skip to content

Commit dc26873

Browse files
committed
s
1 parent f37d352 commit dc26873

File tree

3 files changed

+250
-240
lines changed

3 files changed

+250
-240
lines changed

test/testsimplifytemplate.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ class TestSimplifyTemplate : public TestFixture {
308308
}
309309

310310
#define tok(...) tok_(__FILE__, __LINE__, __VA_ARGS__)
311-
std::string tok_(const char* file, int line, const char code[], bool debugwarnings = false, Platform::Type type = Platform::Type::Native) {
311+
template<size_t size>
312+
std::string tok_(const char* file, int line, const char (&code)[size], bool debugwarnings = false, Platform::Type type = Platform::Type::Native) {
312313
const Settings settings1 = settingsBuilder(settings).library("std.cfg").debugwarnings(debugwarnings).platform(type).build();
313314
SimpleTokenizer tokenizer(settings1, *this);
314315

@@ -5774,7 +5775,8 @@ class TestSimplifyTemplate : public TestFixture {
57745775
}
57755776

57765777
#define instantiateMatch(code, numberOfArguments, patternAfter) instantiateMatch_(code, numberOfArguments, patternAfter, __FILE__, __LINE__)
5777-
bool instantiateMatch_(const char code[], const std::size_t numberOfArguments, const char patternAfter[], const char* file, int line) {
5778+
template<size_t size>
5779+
bool instantiateMatch_(const char (&code)[size], const std::size_t numberOfArguments, const char patternAfter[], const char* file, int line) {
57785780
SimpleTokenizer tokenizer(settings, *this);
57795781

57805782
ASSERT_LOC(tokenizer.tokenize(code), file, line);

test/testtoken.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,13 @@ class TestToken : public TestFixture {
137137
}
138138

139139
#define MatchCheck(...) MatchCheck_(__FILE__, __LINE__, __VA_ARGS__)
140-
bool MatchCheck_(const char* file, int line, const std::string& code, const std::string& pattern, unsigned int varid = 0) {
140+
template<size_t size>
141+
bool MatchCheck_(const char* file, int line, const char (&code)[size], const std::string& pattern, unsigned int varid = 0) {
141142
SimpleTokenizer tokenizer(settingsDefault, *this);
142143
const std::string code2 = ";" + code + ";";
143144
try {
144-
ASSERT_LOC(tokenizer.tokenize(code2.c_str()), file, line);
145+
std::stringstream istr(code2);
146+
ASSERT_LOC(tokenizer.tokenize(istr), file, line);
145147
} catch (...) {}
146148
return Token::Match(tokenizer.tokens()->next(), pattern.c_str(), varid);
147149
}

0 commit comments

Comments
 (0)