mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 17:30:44 +02:00
new trunk (base for 1.5)
windows build only
This commit is contained in:
158
CppParser/testsuite/src/AttributesParserTest.cpp
Normal file
158
CppParser/testsuite/src/AttributesParserTest.cpp
Normal file
@@ -0,0 +1,158 @@
|
||||
//
|
||||
// AttributesParserTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/AttributesParserTest.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "AttributesParserTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/CppParser/Attributes.h"
|
||||
#include "Poco/CppParser/AttributesParser.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
using Poco::CppParser::Attributes;
|
||||
using Poco::CppParser::AttributesParser;
|
||||
|
||||
|
||||
AttributesParserTest::AttributesParserTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
AttributesParserTest::~AttributesParserTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::testParser1()
|
||||
{
|
||||
Attributes attrs;
|
||||
std::istringstream istr("");
|
||||
AttributesParser parser(attrs, istr);
|
||||
parser.parse();
|
||||
assert (attrs.begin() == attrs.end());
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::testParser2()
|
||||
{
|
||||
Attributes attrs;
|
||||
std::istringstream istr("name=value");
|
||||
AttributesParser parser(attrs, istr);
|
||||
parser.parse();
|
||||
assert (attrs.getString("name") == "value");
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::testParser3()
|
||||
{
|
||||
Attributes attrs;
|
||||
std::istringstream istr("name=value, name2=100");
|
||||
AttributesParser parser(attrs, istr);
|
||||
parser.parse();
|
||||
assert (attrs.getString("name") == "value");
|
||||
assert (attrs.getInt("name2") == 100);
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::testParser4()
|
||||
{
|
||||
Attributes attrs;
|
||||
std::istringstream istr("name=value, name2=100, name3");
|
||||
AttributesParser parser(attrs, istr);
|
||||
parser.parse();
|
||||
assert (attrs.getString("name") == "value");
|
||||
assert (attrs.getInt("name2") == 100);
|
||||
assert (attrs.getBool("name3"));
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::testParser5()
|
||||
{
|
||||
Attributes attrs;
|
||||
std::istringstream istr("name.a=value, name.b=100, name.c");
|
||||
AttributesParser parser(attrs, istr);
|
||||
parser.parse();
|
||||
assert (attrs.getString("name.a") == "value");
|
||||
assert (attrs.getInt("name.b") == 100);
|
||||
assert (attrs.getBool("name.c"));
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::testParser6()
|
||||
{
|
||||
Attributes attrs;
|
||||
std::istringstream istr("name = {a=value, b=100, c}");
|
||||
AttributesParser parser(attrs, istr);
|
||||
parser.parse();
|
||||
assert (attrs.getString("name.a") == "value");
|
||||
assert (attrs.getInt("name.b") == 100);
|
||||
assert (attrs.getBool("name.c"));
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::testParser7()
|
||||
{
|
||||
Attributes attrs;
|
||||
std::istringstream istr("name = {a=value, b=100, c}, name2=\"foo\"");
|
||||
AttributesParser parser(attrs, istr);
|
||||
parser.parse();
|
||||
assert (attrs.getString("name.a") == "value");
|
||||
assert (attrs.getInt("name.b") == 100);
|
||||
assert (attrs.getBool("name.c"));
|
||||
assert (attrs.getString("name2") == "foo");
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void AttributesParserTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* AttributesParserTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("AttributesParserTest");
|
||||
|
||||
CppUnit_addTest(pSuite, AttributesParserTest, testParser1);
|
||||
CppUnit_addTest(pSuite, AttributesParserTest, testParser2);
|
||||
CppUnit_addTest(pSuite, AttributesParserTest, testParser3);
|
||||
CppUnit_addTest(pSuite, AttributesParserTest, testParser4);
|
||||
CppUnit_addTest(pSuite, AttributesParserTest, testParser5);
|
||||
CppUnit_addTest(pSuite, AttributesParserTest, testParser6);
|
||||
CppUnit_addTest(pSuite, AttributesParserTest, testParser7);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
66
CppParser/testsuite/src/AttributesParserTest.h
Normal file
66
CppParser/testsuite/src/AttributesParserTest.h
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// AttributesParserTest.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/AttributesParserTest.h#1 $
|
||||
//
|
||||
// Definition of the AttributesParserTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef AttributesParserTest_INCLUDED
|
||||
#define AttributesParserTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/CppParser/CppParser.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class AttributesParserTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
AttributesParserTest(const std::string& name);
|
||||
~AttributesParserTest();
|
||||
|
||||
void testParser1();
|
||||
void testParser2();
|
||||
void testParser3();
|
||||
void testParser4();
|
||||
void testParser5();
|
||||
void testParser6();
|
||||
void testParser7();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // AttributesParserTest_INCLUDED
|
||||
44
CppParser/testsuite/src/AttributesTestSuite.cpp
Normal file
44
CppParser/testsuite/src/AttributesTestSuite.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// AttributesTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/AttributesTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "AttributesTestSuite.h"
|
||||
#include "AttributesParserTest.h"
|
||||
|
||||
|
||||
CppUnit::Test* AttributesTestSuite::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("CppParserTestSuite");
|
||||
|
||||
pSuite->addTest(AttributesParserTest::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
49
CppParser/testsuite/src/AttributesTestSuite.h
Normal file
49
CppParser/testsuite/src/AttributesTestSuite.h
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// AttributesTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/AttributesTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the AttributesTestSuite class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef AttributesTestSuite_INCLUDED
|
||||
#define AttributesTestSuite_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/TestSuite.h"
|
||||
|
||||
|
||||
class AttributesTestSuite
|
||||
{
|
||||
public:
|
||||
static CppUnit::Test* suite();
|
||||
};
|
||||
|
||||
|
||||
#endif // AttributesTestSuite_INCLUDED
|
||||
156
CppParser/testsuite/src/CppParserTest.cpp
Normal file
156
CppParser/testsuite/src/CppParserTest.cpp
Normal file
@@ -0,0 +1,156 @@
|
||||
//
|
||||
// CppParserTest.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/CppParserTest.cpp#2 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "CppParserTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/CppParser/Utility.h"
|
||||
#include "Poco/CppParser/Symbol.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace Poco::CppParser;
|
||||
|
||||
|
||||
std::string linker("cl");
|
||||
std::string options("/I \"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\INCLUDE\", "
|
||||
"/I \"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\PlatformSDK\\include\", "
|
||||
"/I \"p:\\poco\\Foundation\\include\", "
|
||||
"/I \"p:\\poco\\XML\\include\", "
|
||||
"/I \"p:\\poco\\Util\\include\", "
|
||||
"/I \"p:\\poco\\Net\\include\", "
|
||||
"/D \"WIN32\", "
|
||||
"/D \"_DEBUG\", "
|
||||
"/D \"_WINDOWS\", "
|
||||
"/D \"_MBCS\", "
|
||||
"/C, /P, /TP");
|
||||
std::string path("C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\IDE;C:\\Program Files\\Microsoft Visual Studio 8\\VC\\BIN;C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools;;C:\\Program Files\\Microsoft Visual Studio 8\\Common7\\Tools\\bin");
|
||||
|
||||
CppParserTest::CppParserTest(const std::string& name): CppUnit::TestCase(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppParserTest::~CppParserTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CppParserTest::testParseDir()
|
||||
{
|
||||
//FIXME: implement some proper tests
|
||||
return;
|
||||
NameSpace::SymbolTable st;
|
||||
std::vector<std::string> inc;
|
||||
inc.push_back("./*.h");
|
||||
std::vector<std::string> exc;
|
||||
Utility::parseDir(inc, exc, st, linker, options, path);
|
||||
|
||||
NameSpace::SymbolTable::const_iterator it = st.begin();
|
||||
NameSpace::SymbolTable::const_iterator itEnd = st.end();
|
||||
for (it; it != itEnd; ++it)
|
||||
{
|
||||
std::cout << it->first << ": ";
|
||||
Symbol* pSym = it->second;
|
||||
std::cout << pSym->name() << ", " << pSym->getDocumentation() << "\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CppParserTest::testExtractName()
|
||||
{
|
||||
std::string decl("int _var");
|
||||
std::string name = Symbol::extractName(decl);
|
||||
assert (name == "_var");
|
||||
|
||||
decl = "void func(int arg1, int arg2)";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "func");
|
||||
|
||||
decl = "const std::vector<NS::MyType>* var";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "var");
|
||||
|
||||
decl = "const std::vector<NS::MyType>* func(int arg) = 0";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "func");
|
||||
|
||||
decl = "int (*func)(int, const std::string&)";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "func");
|
||||
|
||||
decl = "int ( * func )(int, const std::string&)";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "func");
|
||||
|
||||
decl = "template <typename A, typename B> B func(A a, B b)";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "func");
|
||||
|
||||
decl = "template <typename A, typename B> class Class";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "Class");
|
||||
|
||||
decl = "template <> class Class<int, std::string>";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "Class");
|
||||
|
||||
decl = "template <> class Class <int, std::string>";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "Class");
|
||||
|
||||
decl = "template <> class Class<int, MyTemplate<int> >";
|
||||
name = Symbol::extractName(decl);
|
||||
assert (name == "Class");
|
||||
}
|
||||
|
||||
|
||||
void CppParserTest::setUp()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CppParserTest::tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CppUnit::Test* CppParserTest::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("CppParserTest");
|
||||
|
||||
CppUnit_addTest(pSuite, CppParserTest, testParseDir);
|
||||
CppUnit_addTest(pSuite, CppParserTest, testExtractName);
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
61
CppParser/testsuite/src/CppParserTest.h
Normal file
61
CppParser/testsuite/src/CppParserTest.h
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// CppParserTest.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/CppParserTest.h#2 $
|
||||
//
|
||||
// Definition of the CppParserTest class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppParserTest_INCLUDED
|
||||
#define CppParserTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/CppParser/CppParser.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
|
||||
|
||||
class CppParserTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
CppParserTest(const std::string& name);
|
||||
~CppParserTest();
|
||||
|
||||
void testParseDir();
|
||||
void testExtractName();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
#endif // CppParserTest_INCLUDED
|
||||
46
CppParser/testsuite/src/CppParserTestSuite.cpp
Normal file
46
CppParser/testsuite/src/CppParserTestSuite.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// CppParserTestSuite.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/CppParserTestSuite.cpp#1 $
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "CppParserTestSuite.h"
|
||||
#include "AttributesTestSuite.h"
|
||||
#include "CppParserTest.h"
|
||||
|
||||
|
||||
CppUnit::Test* CppParserTestSuite::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("CppParserTestSuite");
|
||||
|
||||
pSuite->addTest(AttributesTestSuite::suite());
|
||||
pSuite->addTest(CppParserTest::suite());
|
||||
|
||||
return pSuite;
|
||||
}
|
||||
49
CppParser/testsuite/src/CppParserTestSuite.h
Normal file
49
CppParser/testsuite/src/CppParserTestSuite.h
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// CppParserTestSuite.h
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/CppParserTestSuite.h#1 $
|
||||
//
|
||||
// Definition of the CppParserTestSuite class.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#ifndef CppParserTestSuite_INCLUDED
|
||||
#define CppParserTestSuite_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/TestSuite.h"
|
||||
|
||||
|
||||
class CppParserTestSuite
|
||||
{
|
||||
public:
|
||||
static CppUnit::Test* suite();
|
||||
};
|
||||
|
||||
|
||||
#endif // CppParserTestSuite_INCLUDED
|
||||
39
CppParser/testsuite/src/Driver.cpp
Normal file
39
CppParser/testsuite/src/Driver.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Driver.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/Driver.cpp#1 $
|
||||
//
|
||||
// Console-based test driver for Poco CppParser.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestRunner.h"
|
||||
#include "CppParserTestSuite.h"
|
||||
|
||||
|
||||
CppUnitMain(CppParserTestSuite)
|
||||
50
CppParser/testsuite/src/WinDriver.cpp
Normal file
50
CppParser/testsuite/src/WinDriver.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// WinDriver.cpp
|
||||
//
|
||||
// $Id: //poco/1.3/CppParser/testsuite/src/WinDriver.cpp#1 $
|
||||
//
|
||||
// Windows test driver for Poco CppParser.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "WinTestRunner/WinTestRunner.h"
|
||||
#include "CppParserTestSuite.h"
|
||||
|
||||
|
||||
class TestDriver: public CppUnit::WinTestRunnerApp
|
||||
{
|
||||
void TestMain()
|
||||
{
|
||||
CppUnit::WinTestRunner runner;
|
||||
runner.addTest(CppParserTestSuite::suite());
|
||||
runner.run();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TestDriver theDriver;
|
||||
Reference in New Issue
Block a user