unit testing: made Tokenizer functions public so they can be unit tested

This commit is contained in:
Daniel Marjamäki 2010-03-17 22:08:02 +01:00
parent 2441a79c7b
commit 89719b023e
3 changed files with 6 additions and 13 deletions

View File

@ -135,10 +135,6 @@ public:
*/ */
bool simplifyCalculations(); bool simplifyCalculations();
#ifndef _MSC_VER
private:
#endif
/** Insert array size where it isn't given */ /** Insert array size where it isn't given */
void arraySize(); void arraySize();
@ -408,9 +404,6 @@ private:
*/ */
void updateClassList(); void updateClassList();
/** Disable assignments.. */
Tokenizer(const Tokenizer &);
/** /**
* assert that tokens are ok - used during debugging for example * assert that tokens are ok - used during debugging for example
* to catch problems in simplifyTokenList. * to catch problems in simplifyTokenList.
@ -448,7 +441,12 @@ private:
bool duplicateTypedef(Token **tokPtr, const Token *name); bool duplicateTypedef(Token **tokPtr, const Token *name);
void duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string & type); void duplicateTypedefError(const Token *tok1, const Token *tok2, const std::string & type);
/** Disable assignment operator */
private:
/** Disable copy constructor, no implementation */
Tokenizer(const Tokenizer &);
/** Disable assignment operator, no implementation */
Tokenizer &operator=(const Tokenizer &); Tokenizer &operator=(const Tokenizer &);
Token *_tokens, *_tokensBack; Token *_tokens, *_tokensBack;

View File

@ -19,9 +19,7 @@
#include "testsuite.h" #include "testsuite.h"
#define private public
#include "tokenize.h" #include "tokenize.h"
#undef private
#include "token.h" #include "token.h"
#include <sstream> #include <sstream>
@ -2347,7 +2345,6 @@ private:
Settings settings; Settings settings;
Tokenizer tokenizer(&settings, this); Tokenizer tokenizer(&settings, this);
tokenizer._files.push_back("test.cpp");
std::istringstream istr(code); std::istringstream istr(code);
tokenizer.createTokens(istr); tokenizer.createTokens(istr);

View File

@ -23,9 +23,7 @@
#include <cstring> #include <cstring>
#include "testsuite.h" #include "testsuite.h"
#define private public
#include "tokenize.h" #include "tokenize.h"
#undef private
#include "token.h" #include "token.h"
extern std::ostringstream errout; extern std::ostringstream errout;