From 84286e0d5f4fae954436c433d49b14b5226038fb Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 11 Jun 2020 08:46:18 +0100 Subject: [PATCH] Remove unnecessary Plugin::operator< overload --- src/api/plugin.cpp | 4 ---- src/api/plugin.h | 2 -- src/api/sorting/plugin_graph.cpp | 2 +- src/tests/api/internals/plugin_test.h | 21 --------------------- 4 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index d0cde3e0..b079eb37 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -261,10 +261,6 @@ uintmax_t Plugin::GetFileSize(std::filesystem::path pluginPath) { return std::filesystem::file_size(pluginPath); } -bool Plugin::operator<(const Plugin& rhs) const { - return CompareFilenames(name_, rhs.name_) < 0; -} - void Plugin::Load(const std::filesystem::path& path, GameType gameType, bool headerOnly) { diff --git a/src/api/plugin.h b/src/api/plugin.h index 319a770d..b481cb97 100644 --- a/src/api/plugin.h +++ b/src/api/plugin.h @@ -73,8 +73,6 @@ public: const std::filesystem::path& pluginPath); static uintmax_t GetFileSize(std::filesystem::path pluginPath); - bool operator<(const Plugin& rhs) const; - private: void Load(const std::filesystem::path& path, GameType gameType, diff --git a/src/api/sorting/plugin_graph.cpp b/src/api/sorting/plugin_graph.cpp index 8567ecff..63e23e1e 100644 --- a/src/api/sorting/plugin_graph.cpp +++ b/src/api/sorting/plugin_graph.cpp @@ -200,7 +200,7 @@ void PluginGraph::AddPluginVertices(Game& game, return true; } - return *lhs < *rhs; + return lhs->GetName() < rhs->GetName(); }); for (const auto& plugin : loadedPlugins) { diff --git a/src/tests/api/internals/plugin_test.h b/src/tests/api/internals/plugin_test.h index f53793e0..d2119fd1 100644 --- a/src/tests/api/internals/plugin_test.h +++ b/src/tests/api/internals/plugin_test.h @@ -437,27 +437,6 @@ TEST_P(PluginTest, getFileSizeShouldReturnCorrectValueForAGhostedPlugin) { Plugin::GetFileSize(game_.DataPath() / blankMasterDependentEsm)); } -TEST_P(PluginTest, - lessThanOperatorShouldUseCaseInsensitiveLexicographicalNameComparison) { - Plugin plugin1( - game_.Type(), game_.GetCache(), game_.DataPath() / blankEsp, true); - Plugin plugin2(game_.Type(), - game_.GetCache(), - game_.DataPath() / lowercaseBlankEsp, - true); - - EXPECT_FALSE(plugin1 < plugin2); - EXPECT_FALSE(plugin2 < plugin1); - - Plugin plugin3 = - Plugin(game_.Type(), game_.GetCache(), game_.DataPath() / blankEsm, true); - Plugin plugin4 = - Plugin(game_.Type(), game_.GetCache(), game_.DataPath() / blankEsp, true); - - EXPECT_TRUE(plugin3 < plugin4); - EXPECT_FALSE(plugin4 < plugin3); -} - TEST_P(PluginTest, doFormIDsOverlapShouldReturnFalseIfTheArgumentIsNotAPluginObject) { Plugin plugin1(