mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Separate some tests to make them more specific.
This commit is contained in:
parent
499f6db977
commit
2651372291
@ -32,12 +32,13 @@ using namespace TagLib;
|
||||
class TestList : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestList);
|
||||
CPPUNIT_TEST(testList);
|
||||
CPPUNIT_TEST(testAppend);
|
||||
CPPUNIT_TEST(testDetach);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
|
||||
void testList()
|
||||
void testAppend()
|
||||
{
|
||||
List<int> l1;
|
||||
List<int> l2;
|
||||
@ -51,14 +52,25 @@ public:
|
||||
l3.append(2);
|
||||
l3.append(3);
|
||||
l3.append(4);
|
||||
CPPUNIT_ASSERT_EQUAL(4U, l1.size());
|
||||
CPPUNIT_ASSERT(l1 == l3);
|
||||
|
||||
List<int> l4 = l1;
|
||||
List<int>::Iterator it = l4.find(3);
|
||||
*it = 33;
|
||||
CPPUNIT_ASSERT_EQUAL(l1[2], 3);
|
||||
CPPUNIT_ASSERT_EQUAL(l4[2], 33);
|
||||
}
|
||||
|
||||
void testDetach()
|
||||
{
|
||||
List<int> l1;
|
||||
l1.append(1);
|
||||
l1.append(2);
|
||||
l1.append(3);
|
||||
l1.append(4);
|
||||
|
||||
List<int> l2 = l1;
|
||||
List<int>::Iterator it = l2.find(3);
|
||||
*it = 33;
|
||||
CPPUNIT_ASSERT_EQUAL(3, l1[2]);
|
||||
CPPUNIT_ASSERT_EQUAL(33, l2[2]);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestList);
|
||||
|
@ -34,6 +34,7 @@ class TestMap : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestMap);
|
||||
CPPUNIT_TEST(testInsert);
|
||||
CPPUNIT_TEST(testDetach);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -42,19 +43,28 @@ public:
|
||||
{
|
||||
Map<String, int> m1;
|
||||
m1.insert("foo", 3);
|
||||
m1.insert("bar", 5);
|
||||
CPPUNIT_ASSERT_EQUAL(2U, m1.size());
|
||||
CPPUNIT_ASSERT_EQUAL(3, m1["foo"]);
|
||||
CPPUNIT_ASSERT_EQUAL(5, m1["bar"]);
|
||||
m1.insert("foo", 7);
|
||||
CPPUNIT_ASSERT_EQUAL(2U, m1.size());
|
||||
CPPUNIT_ASSERT_EQUAL(7, m1["foo"]);
|
||||
CPPUNIT_ASSERT_EQUAL(5, m1["bar"]);
|
||||
}
|
||||
|
||||
m1.insert("alice", 5);
|
||||
m1.insert("bob", 9);
|
||||
void testDetach()
|
||||
{
|
||||
Map<String, int> m1;
|
||||
m1.insert("alice", 5);
|
||||
m1.insert("bob", 9);
|
||||
m1.insert("carol", 11);
|
||||
|
||||
Map<String, int> m2 = m1;
|
||||
Map<String, int>::Iterator it = m2.find("bob");
|
||||
(*it).second = 99;
|
||||
CPPUNIT_ASSERT_EQUAL(m1["bob"], 9);
|
||||
CPPUNIT_ASSERT_EQUAL(m2["bob"], 99);
|
||||
CPPUNIT_ASSERT_EQUAL(9, m1["bob"]);
|
||||
CPPUNIT_ASSERT_EQUAL(99, m2["bob"]);
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user