core/index: Remove index_entry :: size()
It was only used by the testing code, so there is really no reason to keep it around. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
58f704cdd2
commit
a8bb7ffccd
|
@ -14,11 +14,6 @@ const std::string index_entry :: primary_key() const
|
|||
return ie_key;
|
||||
}
|
||||
|
||||
size_t index_entry :: size()
|
||||
{
|
||||
return ie_set.size();
|
||||
}
|
||||
|
||||
typename index_entry::iterator index_entry :: begin()
|
||||
{
|
||||
return ie_set.begin();
|
||||
|
|
|
@ -40,13 +40,6 @@ struct index_entry : public DatabaseEntry {
|
|||
*/
|
||||
const std::string primary_key() const;
|
||||
|
||||
/**
|
||||
* Called to find the number of values in our backing std::set.
|
||||
*
|
||||
* @return IndexEntry::_values.size()
|
||||
*/
|
||||
size_t size();
|
||||
|
||||
/**
|
||||
* @return An iterator pointing to the first item in IndexEntry::_values
|
||||
*/
|
||||
|
|
|
@ -11,13 +11,11 @@ static void test_entry()
|
|||
index_entry *ie = new index_entry("Link");
|
||||
struct file f;
|
||||
|
||||
test_equal(ie->primary_key(), "Link");
|
||||
ie->ie_set.insert(0);
|
||||
ie->ie_set.insert(1);
|
||||
ie->ie_set.insert(2);
|
||||
|
||||
test_equal(ie->primary_key(), "Link");
|
||||
test_equal(ie->size(), 3);
|
||||
|
||||
file_init(&f, "index_entry", 0);
|
||||
file_open(&f, OPEN_WRITE);
|
||||
file_writef(&f, "Zelda\n0 \n");
|
||||
|
@ -27,16 +25,16 @@ static void test_entry()
|
|||
|
||||
ie = new index_entry();
|
||||
test_equal(ie->primary_key(), "");
|
||||
test_equal(ie->size(), 0);
|
||||
test_equal(ie->ie_set.size(), 0);
|
||||
|
||||
file_open(&f, OPEN_READ);
|
||||
ie->read(f);
|
||||
test_equal(ie->primary_key(), "Zelda");
|
||||
test_equal(ie->size(), 0);
|
||||
test_equal(ie->ie_set.size(), 0);
|
||||
|
||||
ie->read(f);
|
||||
test_equal(ie->primary_key(), "Link");
|
||||
test_equal(ie->size(), 3);
|
||||
test_equal(ie->ie_set.size(), 3);
|
||||
file_close(&f);
|
||||
|
||||
delete ie;
|
||||
|
@ -81,7 +79,7 @@ static void test_stress(unsigned int N)
|
|||
index_remove(&index, key.c_str(), i);
|
||||
ie = db_find(&index, key.c_str());
|
||||
test_loop_not_equal(ie, NULL, c - 'a');
|
||||
test_loop_equal(ie->size(), 0, c - 'a');
|
||||
test_loop_equal(ie->ie_set.size(), 0, c - 'a');
|
||||
} test_loop_passed();
|
||||
index_remove(&index, "ZZ", 42);
|
||||
test_equal(index.db_size, 26);
|
||||
|
|
|
@ -30,10 +30,10 @@ static void test_init()
|
|||
playlist :: init();
|
||||
|
||||
ent = playlist :: get_tracks("Banned");
|
||||
test_equal(ent->size(), (size_t)4);
|
||||
test_equal(ent->ie_set.size(), (size_t)4);
|
||||
test_equal(library :: get_queue()->size(), (unsigned)20);
|
||||
ent = playlist :: get_tracks("Favorites");
|
||||
test_equal(ent->size(), (size_t)8);
|
||||
test_equal(ent->ie_set.size(), (size_t)8);
|
||||
ent = playlist :: get_tracks("No Such Playlist");
|
||||
test_equal(ent, IDX_NULL);
|
||||
}
|
||||
|
@ -68,14 +68,14 @@ static void test_add()
|
|||
|
||||
playlist :: add(tags :: get_track(5), "Banned");
|
||||
ent = playlist :: get_tracks("Banned");
|
||||
test_equal(ent->size(), (size_t)5);
|
||||
test_equal(ent->ie_set.size(), (size_t)5);
|
||||
test_equal(q->size(), (unsigned)8);
|
||||
test_equal(l->size(), (unsigned)19);
|
||||
|
||||
playlist :: add(tags :: get_track(16), "Favorites");
|
||||
playlist :: add(tags :: get_track(5), "Favorites");
|
||||
ent = playlist :: get_tracks("Favorites");
|
||||
test_equal(ent->size(), (size_t)9);
|
||||
test_equal(ent->ie_set.size(), (size_t)9);
|
||||
test_equal(q->size(), (unsigned)9);
|
||||
|
||||
playlist :: add(tags :: get_track(6), "No Playlist");
|
||||
|
@ -90,13 +90,13 @@ static void test_delete()
|
|||
|
||||
playlist :: del(tags :: get_track(5), "Banned");
|
||||
ent = playlist :: get_tracks("Banned");
|
||||
test_equal(ent->size(), (size_t)4);
|
||||
test_equal(ent->ie_set.size(), (size_t)4);
|
||||
test_equal(q->size(), (unsigned)9);
|
||||
test_equal(l->size(), (unsigned)20);
|
||||
|
||||
playlist :: del(tags :: get_track(5), "Favorites");
|
||||
ent = playlist :: get_tracks("Favorites");
|
||||
test_equal(ent->size(), (size_t)8);
|
||||
test_equal(ent->ie_set.size(), (size_t)8);
|
||||
test_equal(q->size(), (unsigned)8);
|
||||
|
||||
playlist :: del(tags :: get_track(6), "No Playlist");
|
||||
|
|
Loading…
Reference in New Issue