mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Simplify overly complicated ByteVector::mid() implementation.
Especially remove the useless nested RefCounters.
This commit is contained in:
@ -43,6 +43,7 @@ class TestByteVector : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testReplace);
|
||||
CPPUNIT_TEST(testIterator);
|
||||
CPPUNIT_TEST(testResize);
|
||||
CPPUNIT_TEST(testAppend);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -312,6 +313,8 @@ public:
|
||||
*it2 = 'I';
|
||||
CPPUNIT_ASSERT_EQUAL('i', *it1);
|
||||
CPPUNIT_ASSERT_EQUAL('I', *it2);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglib"), v1);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglIb"), v2);
|
||||
|
||||
ByteVector::ReverseIterator it3 = v1.rbegin();
|
||||
ByteVector::ReverseIterator it4 = v2.rbegin();
|
||||
@ -324,6 +327,8 @@ public:
|
||||
*it4 = 'A';
|
||||
CPPUNIT_ASSERT_EQUAL('a', *it3);
|
||||
CPPUNIT_ASSERT_EQUAL('A', *it4);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglib"), v1);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("tAglIb"), v2);
|
||||
|
||||
ByteVector v3;
|
||||
v3 = ByteVector("0123456789").mid(3, 4);
|
||||
@ -383,6 +388,20 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(-1, c.find('C'));
|
||||
}
|
||||
|
||||
void testAppend()
|
||||
{
|
||||
ByteVector v1("taglib");
|
||||
ByteVector v2 = v1;
|
||||
|
||||
v1.append("ABC");
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglibABC"), v1);
|
||||
v1.append('1');
|
||||
v1.append('2');
|
||||
v1.append('3');
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglibABC123"), v1);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglib"), v2);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestByteVector);
|
||||
|
Reference in New Issue
Block a user