Refactoring: Renamed all files to lower case. Also added testfilelister.cpp which was forgotted from previous commit.

This commit is contained in:
Reijo Tomperi 2008-12-14 20:49:55 +00:00
parent a15381dcbe
commit 3851c0f019
16 changed files with 113 additions and 69 deletions

View File

@ -1,4 +1,4 @@
SRCS=CheckBufferOverrun.cpp CheckClass.cpp CheckHeaders.cpp CheckMemoryLeak.cpp CheckFunctionUsage.cpp CheckOther.cpp FileLister.cpp preprocessor.cpp tokenize.cpp cppcheck.cpp settings.cpp token.cpp cppcheckexecutor.cpp
SRCS=checkbufferoverrun.cpp checkclass.cpp checkheaders.cpp checkmemoryleak.cpp checkfunctionusage.cpp checkother.cpp filelister.cpp preprocessor.cpp tokenize.cpp cppcheck.cpp settings.cpp token.cpp cppcheckexecutor.cpp
OBJS=$(SRCS:%.cpp=%.o)
TESTS=testbufferoverrun.o testcharvar.o testclass.o testconstructors.o testdivision.o testfunctionusage.o testincompletestatement.o testmemleak.o testpreprocessor.o testsimplifytokens.o testtokenize.o testtoken.o testunusedprivfunc.o testunusedvar.o testfilelister.o
BIN = ${DESTDIR}/usr/bin
@ -9,43 +9,43 @@ test: ${OBJS} testrunner.o testsuite.o ${TESTS}
g++ -Wall -g -o testrunner $^
cppcheckexecutor.o: cppcheckexecutor.cpp cppcheckexecutor.h cppcheck.h errorlogger.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
cppcheck.o: cppcheck.cpp cppcheck.h settings.h errorlogger.h preprocessor.h tokenize.h token.h CheckMemoryLeak.h CheckBufferOverrun.h CheckClass.h CheckHeaders.h CheckOther.h CheckFunctionUsage.h FileLister.h
cppcheck.o: cppcheck.cpp cppcheck.h settings.h errorlogger.h preprocessor.h tokenize.h token.h checkmemoryleak.h checkbufferoverrun.h checkclass.h checkheaders.h checkother.h checkfunctionusage.h filelister.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
main.o: main.cpp cppcheck.h settings.h errorlogger.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
CheckBufferOverrun.o: CheckBufferOverrun.cpp CheckBufferOverrun.h tokenize.h settings.h errorlogger.h token.h
checkbufferoverrun.o: checkbufferoverrun.cpp checkbufferoverrun.h tokenize.h settings.h errorlogger.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
CheckClass.o: CheckClass.cpp CheckClass.h tokenize.h settings.h errorlogger.h token.h
checkclass.o: checkclass.cpp checkclass.h tokenize.h settings.h errorlogger.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
CheckFunctionUsage.o: CheckFunctionUsage.cpp CheckFunctionUsage.h tokenize.h settings.h errorlogger.h token.h
checkfunctionusage.o: checkfunctionusage.cpp checkfunctionusage.h tokenize.h settings.h errorlogger.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
CheckHeaders.o: CheckHeaders.cpp CheckHeaders.h tokenize.h settings.h errorlogger.h token.h
checkheaders.o: checkheaders.cpp checkheaders.h tokenize.h settings.h errorlogger.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
CheckMemoryLeak.o: CheckMemoryLeak.cpp CheckMemoryLeak.h tokenize.h settings.h errorlogger.h token.h
checkmemoryleak.o: checkmemoryleak.cpp checkmemoryleak.h tokenize.h settings.h errorlogger.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
CheckOther.o: CheckOther.cpp CheckOther.h tokenize.h settings.h errorlogger.h token.h
checkother.o: checkother.cpp checkother.h tokenize.h settings.h errorlogger.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
FileLister.o: FileLister.cpp FileLister.h
filelister.o: filelister.cpp filelister.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
preprocessor.o: preprocessor.cpp preprocessor.h errorlogger.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
settings.o: settings.cpp settings.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testbufferoverrun.o: testbufferoverrun.cpp tokenize.h settings.h errorlogger.h token.h CheckBufferOverrun.h testsuite.h
testbufferoverrun.o: testbufferoverrun.cpp tokenize.h settings.h errorlogger.h token.h checkbufferoverrun.h testsuite.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testcharvar.o: testcharvar.cpp tokenize.h settings.h errorlogger.h token.h CheckOther.h testsuite.h
testcharvar.o: testcharvar.cpp tokenize.h settings.h errorlogger.h token.h checkother.h testsuite.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testclass.o: testclass.cpp tokenize.h settings.h errorlogger.h token.h CheckClass.h testsuite.h
testclass.o: testclass.cpp tokenize.h settings.h errorlogger.h token.h checkclass.h testsuite.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testconstructors.o: testconstructors.cpp tokenize.h settings.h errorlogger.h token.h CheckClass.h testsuite.h
testconstructors.o: testconstructors.cpp tokenize.h settings.h errorlogger.h token.h checkclass.h testsuite.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testdivision.o: testdivision.cpp tokenize.h settings.h errorlogger.h token.h CheckOther.h testsuite.h
testdivision.o: testdivision.cpp tokenize.h settings.h errorlogger.h token.h checkother.h testsuite.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testfunctionusage.o: testfunctionusage.cpp tokenize.h settings.h errorlogger.h token.h testsuite.h CheckFunctionUsage.h
testfunctionusage.o: testfunctionusage.cpp tokenize.h settings.h errorlogger.h token.h testsuite.h checkfunctionusage.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testincompletestatement.o: testincompletestatement.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h CheckOther.h
testincompletestatement.o: testincompletestatement.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h checkother.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testmemleak.o: testmemleak.cpp tokenize.h settings.h errorlogger.h token.h CheckMemoryLeak.h testsuite.h
testmemleak.o: testmemleak.cpp tokenize.h settings.h errorlogger.h token.h checkmemoryleak.h testsuite.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testpreprocessor.o: testpreprocessor.cpp testsuite.h errorlogger.h preprocessor.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
@ -59,15 +59,15 @@ testtoken.o: testtoken.cpp testsuite.h errorlogger.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testtokenize.o: testtokenize.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testunusedprivfunc.o: testunusedprivfunc.cpp tokenize.h settings.h errorlogger.h token.h CheckClass.h testsuite.h
testunusedprivfunc.o: testunusedprivfunc.cpp tokenize.h settings.h errorlogger.h token.h checkclass.h testsuite.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testunusedvar.o: testunusedvar.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h CheckOther.h
testunusedvar.o: testunusedvar.cpp testsuite.h errorlogger.h tokenize.h settings.h token.h checkother.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
testfilelister.o: testfilelister.cpp FileLister.h
testfilelister.o: testfilelister.cpp filelister.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
token.o: token.cpp token.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
tokenize.o: tokenize.cpp tokenize.h settings.h errorlogger.h token.h FileLister.h
tokenize.o: tokenize.cpp tokenize.h settings.h errorlogger.h token.h filelister.h
g++ -Wall -pedantic -g -I. -o $@ -c $*.cpp
clean:

View File

@ -30,50 +30,41 @@
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="CheckBufferOverrun.cpp" />
<Unit filename="CheckBufferOverrun.h" />
<Unit filename="CheckClass.cpp" />
<Unit filename="CheckClass.h" />
<Unit filename="CheckFunctionUsage.cpp" />
<Unit filename="CheckFunctionUsage.h" />
<Unit filename="CheckHeaders.cpp" />
<Unit filename="CheckHeaders.h" />
<Unit filename="CheckMemoryLeak.cpp" />
<Unit filename="CheckMemoryLeak.h" />
<Unit filename="CheckOther.cpp" />
<Unit filename="CheckOther.h" />
<Unit filename="FileLister.cpp" />
<Unit filename="FileLister.h" />
<Unit filename="checkbufferoverrun.cpp" />
<Unit filename="checkbufferoverrun.h" />
<Unit filename="checkclass.cpp" />
<Unit filename="checkclass.h" />
<Unit filename="checkfunctionusage.cpp" />
<Unit filename="checkfunctionusage.h" />
<Unit filename="checkheaders.cpp" />
<Unit filename="checkheaders.h" />
<Unit filename="checkmemoryleak.cpp" />
<Unit filename="checkmemoryleak.h" />
<Unit filename="checkother.cpp" />
<Unit filename="checkother.h" />
<Unit filename="cppcheck.cpp" />
<Unit filename="cppcheck.h" />
<Unit filename="cppcheckexecutor.cpp">
<Option target="all" />
</Unit>
<Unit filename="cppcheckexecutor.h">
<Option target="all" />
</Unit>
<Unit filename="cppcheckexecutor.cpp" />
<Unit filename="cppcheckexecutor.h" />
<Unit filename="errorlogger.h" />
<Unit filename="main.cpp">
<Option target="all" />
</Unit>
<Unit filename="filelister.cpp" />
<Unit filename="filelister.h" />
<Unit filename="main.cpp" />
<Unit filename="preprocessor.cpp" />
<Unit filename="preprocessor.h" />
<Unit filename="settings.cpp" />
<Unit filename="settings.h" />
<Unit filename="testbufferoverrun.cpp" />
<Unit filename="testcharvar.cpp" />
<Unit filename="testclass.cpp">
<Option target="test" />
</Unit>
<Unit filename="testclass.cpp" />
<Unit filename="testconstructors.cpp" />
<Unit filename="testdivision.cpp" />
<Unit filename="testfilelister.cpp" />
<Unit filename="testfunctionusage.cpp" />
<Unit filename="testincompletestatement.cpp" />
<Unit filename="testmemleak.cpp" />
<Unit filename="testpreprocessor.cpp" />
<Unit filename="testrunner.cpp">
<Option target="test" />
</Unit>
<Unit filename="testrunner.cpp" />
<Unit filename="testsimplifytokens.cpp" />
<Unit filename="testsuite.cpp" />
<Unit filename="testsuite.h" />

View File

@ -20,13 +20,13 @@
#include "preprocessor.h" // preprocessor.
#include "tokenize.h" // <- Tokenizer
#include "CheckMemoryLeak.h"
#include "CheckBufferOverrun.h"
#include "CheckClass.h"
#include "CheckHeaders.h"
#include "CheckOther.h"
#include "CheckFunctionUsage.h"
#include "FileLister.h"
#include "checkmemoryleak.h"
#include "checkbufferoverrun.h"
#include "checkclass.h"
#include "checkheaders.h"
#include "checkother.h"
#include "checkfunctionusage.h"
#include "filelister.h"
#include <algorithm>
#include <sstream>

View File

@ -26,7 +26,7 @@
#include <map>
#include "settings.h"
#include "errorlogger.h"
#include "CheckFunctionUsage.h"
#include "checkfunctionusage.h"
/**
* This is the base class which will use other classes to do

View File

@ -19,7 +19,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "CheckBufferOverrun.h"
#include "checkbufferoverrun.h"
#include "testsuite.h"
#include <sstream>

View File

@ -19,7 +19,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "CheckOther.h"
#include "checkother.h"
#include "testsuite.h"
#include <sstream>

View File

@ -20,7 +20,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "CheckClass.h"
#include "checkclass.h"
#include "testsuite.h"
#include <sstream>

View File

@ -20,7 +20,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "CheckClass.h"
#include "checkclass.h"
#include "testsuite.h"
#include <sstream>

View File

@ -23,7 +23,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "CheckOther.h"
#include "checkother.h"
#include "testsuite.h"
#include <sstream>

53
testfilelister.cpp Normal file
View File

@ -0,0 +1,53 @@
/*
* c++check - c/c++ syntax checking
* Copyright (C) 2008 Daniel Marjamäki and Reijo Tomperi
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/
*/
#include <string>
#include "testsuite.h"
#include "filelister.h"
class TestFileLister : public TestFixture
{
public:
TestFileLister() : TestFixture("TestFileLister")
{ }
private:
void run()
{
TEST_CASE( simplify_path );
}
void simplify_path()
{
ASSERT_EQUALS( std::string( "index.h" ), FileLister::simplifyPath( "index.h" ) );
ASSERT_EQUALS( std::string( "/index.h" ), FileLister::simplifyPath( "/index.h" ) );
ASSERT_EQUALS( std::string( "/path/" ), FileLister::simplifyPath( "/path/" ) );
ASSERT_EQUALS( std::string( "/" ), FileLister::simplifyPath( "/" ) );
ASSERT_EQUALS( std::string( "./index.h" ), FileLister::simplifyPath( "./index.h" ) );
ASSERT_EQUALS( std::string( "../index.h" ), FileLister::simplifyPath( "../index.h" ) );
ASSERT_EQUALS( std::string( "/index.h" ), FileLister::simplifyPath( "/path/../index.h" ) );
ASSERT_EQUALS( std::string( "/index.h" ), FileLister::simplifyPath( "/path/../other/../index.h" ) );
ASSERT_EQUALS( std::string( "/index.h" ), FileLister::simplifyPath( "/path/../other///././../index.h" ) );
ASSERT_EQUALS( std::string( "../path/index.h" ), FileLister::simplifyPath( "../path/other/../index.h" ) );
}
};
REGISTER_TEST( TestFileLister )

View File

@ -20,7 +20,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "testsuite.h"
#include "CheckFunctionUsage.h"
#include "checkfunctionusage.h"
#include <sstream>
extern std::ostringstream errout;

View File

@ -23,7 +23,7 @@
#define UNIT_TESTING
#include "testsuite.h"
#include "tokenize.h"
#include "CheckOther.h"
#include "checkother.h"
#include <sstream>

View File

@ -21,7 +21,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "CheckMemoryLeak.h"
#include "checkmemoryleak.h"
#include "testsuite.h"
#include <iostream>

View File

@ -19,7 +19,7 @@
#define UNIT_TESTING
#include "tokenize.h"
#include "CheckClass.h"
#include "checkclass.h"
#include "testsuite.h"
#include <sstream>

View File

@ -23,7 +23,7 @@
#define UNIT_TESTING
#include "testsuite.h"
#include "tokenize.h"
#include "CheckOther.h"
#include "checkother.h"
#include <sstream>
extern std::ostringstream errout;

View File

@ -34,7 +34,7 @@
#include <algorithm>
#include <stdlib.h> // <- strtoul
#include <stdio.h>
#include <FileLister.h>
#include <filelister.h>
#ifdef __BORLANDC__
#include <ctype.h>