1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-04-11 23:07:13 +02:00
SqMod/vendor/POCO/XML/testsuite/src/NamePoolTest.cpp
Sandu Liviu Catalin 4a6bfc086c Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface.
Deprecated the external module API. It was creating more problems than solving.
Removed most built-in libraries in favor of system libraries for easier maintenance.
Cleaned and secured code with help from static analyzers.
2021-01-30 08:51:39 +02:00

73 lines
1.3 KiB
C++

//
// NamePoolTest.cpp
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "NamePoolTest.h"
#include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h"
#include "Poco/XML/NamePool.h"
#include "Poco/XML/Name.h"
#include "Poco/DOM/AutoPtr.h"
using Poco::XML::NamePool;
using Poco::XML::Name;
using Poco::XML::AutoPtr;
NamePoolTest::NamePoolTest(const std::string& name): CppUnit::TestCase(name)
{
}
NamePoolTest::~NamePoolTest()
{
}
void NamePoolTest::testNamePool()
{
AutoPtr<NamePool> pool = new NamePool;
const Name* pName = 0;
Name name("pre:local", "http://www.appinf.com");
pName = &pool->insert(name);
const Name* pName2 = &pool->insert("pre:local", "http://www.appinf.com", "local");
assertTrue (pName == pName2);
pName2 = &pool->insert("pre:local2", "http://www.appinf.com", "local2");
assertTrue (pName2 != pName);
pName2 = &pool->insert(name);
assertTrue (pName2 == pName);
pName2 = &pool->insert(*pName);
assertTrue (pName2 == pName);
}
void NamePoolTest::setUp()
{
}
void NamePoolTest::tearDown()
{
}
CppUnit::Test* NamePoolTest::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("NamePoolTest");
CppUnit_addTest(pSuite, NamePoolTest, testNamePool);
return pSuite;
}