2008-01-05 11:26:56 +00:00
|
|
|
#include "TaggedItem.h"
|
|
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
namespace aria2 {
|
|
|
|
|
2008-01-05 11:26:56 +00:00
|
|
|
class TaggedItemTest:public CppUnit::TestFixture {
|
|
|
|
|
|
|
|
CPPUNIT_TEST_SUITE(TaggedItemTest);
|
|
|
|
CPPUNIT_TEST(testHasTag);
|
|
|
|
CPPUNIT_TEST(testToTagString);
|
2008-01-11 14:10:42 +00:00
|
|
|
CPPUNIT_TEST(testOperatorEqual);
|
2008-01-05 11:26:56 +00:00
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
private:
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setUp() {}
|
|
|
|
|
|
|
|
void testHasTag();
|
|
|
|
void testToTagString();
|
2008-01-11 14:10:42 +00:00
|
|
|
void testOperatorEqual();
|
2008-01-05 11:26:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION(TaggedItemTest);
|
|
|
|
|
|
|
|
void TaggedItemTest::testHasTag()
|
|
|
|
{
|
|
|
|
TaggedItem item("alpha");
|
|
|
|
item.addTag("foo");
|
|
|
|
item.addTag("bar");
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT(item.hasTag("bar"));
|
|
|
|
CPPUNIT_ASSERT(!item.hasTag("boo"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void TaggedItemTest::testToTagString()
|
|
|
|
{
|
|
|
|
TaggedItem item("alpha");
|
|
|
|
item.addTag("foo");
|
|
|
|
item.addTag("bar");
|
|
|
|
|
2008-02-08 15:53:45 +00:00
|
|
|
CPPUNIT_ASSERT_EQUAL(std::string("foo,bar"), item.toTagString());
|
2008-01-05 11:26:56 +00:00
|
|
|
}
|
2008-01-11 14:10:42 +00:00
|
|
|
|
|
|
|
void TaggedItemTest::testOperatorEqual()
|
|
|
|
{
|
|
|
|
TaggedItem none("");
|
|
|
|
TaggedItem foo("foo");
|
|
|
|
TaggedItem foo2("foo");
|
|
|
|
TaggedItem bar("bar");
|
|
|
|
CPPUNIT_ASSERT(!(none == foo));
|
|
|
|
CPPUNIT_ASSERT(!(bar == foo));
|
|
|
|
CPPUNIT_ASSERT(foo == foo);
|
|
|
|
}
|
2008-02-08 15:53:45 +00:00
|
|
|
|
|
|
|
} // namespace aria2
|