From a8bb7ffccd5c2d2db4afb9e68389b50cdd6427b5 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 21 Oct 2015 15:30:24 -0400 Subject: [PATCH] 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 --- core/index.cpp | 5 ----- include/core/index.h | 7 ------- tests/core/index.cpp | 12 +++++------- tests/core/playlist.cpp | 12 ++++++------ 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/core/index.cpp b/core/index.cpp index 8a0623e5..d09f1845 100644 --- a/core/index.cpp +++ b/core/index.cpp @@ -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(); diff --git a/include/core/index.h b/include/core/index.h index 8720e532..68b03b3f 100644 --- a/include/core/index.h +++ b/include/core/index.h @@ -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 */ diff --git a/tests/core/index.cpp b/tests/core/index.cpp index 5216159d..b6762410 100644 --- a/tests/core/index.cpp +++ b/tests/core/index.cpp @@ -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); diff --git a/tests/core/playlist.cpp b/tests/core/playlist.cpp index 7f4c7688..8bc9c61c 100644 --- a/tests/core/playlist.cpp +++ b/tests/core/playlist.cpp @@ -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");