From 8fe711ddeb1a88e107b52094bd303b003910b372 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 29 Dec 2021 09:46:58 -0800 Subject: [PATCH] Fix ResultType tests Signed-off-by: Louise Poubel --- src/FuelClient_TEST.cc | 90 +++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/FuelClient_TEST.cc b/src/FuelClient_TEST.cc index 53876d1f..9ac83052 100644 --- a/src/FuelClient_TEST.cc +++ b/src/FuelClient_TEST.cc @@ -423,13 +423,13 @@ TEST_F(FuelClientTest, DownloadModel) std::string cachedPath; Result res1 = client.CachedModel(url, cachedPath); EXPECT_FALSE(res1); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), res1); + EXPECT_EQ(ResultType::FETCH_ERROR, res1.Type()); // Download std::string path; Result res2 = client.DownloadModel(url, path); EXPECT_TRUE(res2); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res2); + EXPECT_EQ(ResultType::FETCH, res2.Type()); // Check it was downloaded to `2` auto modelPath = common::joinPaths(common::cwd(), "test_cache", @@ -447,7 +447,7 @@ TEST_F(FuelClientTest, DownloadModel) // Check it is cached Result res3 = client.CachedModel(url, cachedPath); EXPECT_TRUE(res3); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res3); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, res3.Type()); EXPECT_EQ(common::joinPaths(modelPath, "2"), cachedPath); } @@ -461,13 +461,13 @@ TEST_F(FuelClientTest, DownloadModel) std::string cachedPath; Result res1 = client.CachedModel(url, cachedPath); EXPECT_FALSE(res1); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), res1); + EXPECT_EQ(ResultType::FETCH_ERROR, res1.Type()); // Download std::string path; Result res2 = client.DownloadModel(url, path); EXPECT_TRUE(res2); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res2); + EXPECT_EQ(ResultType::FETCH, res2.Type()); // Check it was downloaded to `2` auto modelPath = common::joinPaths(common::cwd(), "test_cache", @@ -485,7 +485,7 @@ TEST_F(FuelClientTest, DownloadModel) // Check it is cached Result res3 = client.CachedModel(url, cachedPath); EXPECT_TRUE(res3); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res3); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, res3.Type()); EXPECT_EQ(common::joinPaths(modelPath, "2"), cachedPath); // Check that URIs have been updated. @@ -516,28 +516,28 @@ TEST_F(FuelClientTest, DownloadModel) std::string cachedPath; Result res1 = client.CachedModel(url, cachedPath); EXPECT_FALSE(res1); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), res1); + EXPECT_EQ(ResultType::FETCH_ERROR, res1.Type()); // Check the dependency is not cached Result res2 = client.CachedModel(depUrl, cachedPath); EXPECT_FALSE(res2); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), res2); + EXPECT_EQ(ResultType::FETCH_ERROR, res2.Type()); // Download std::string path; Result res3 = client.DownloadModel(url, path); EXPECT_TRUE(res3); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res3); + EXPECT_EQ(ResultType::FETCH, res3.Type()); // Check it is cached Result res4 = client.CachedModel(url, cachedPath); EXPECT_TRUE(res4); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res4); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, res4.Type()); // Check the dependency is cached Result res5 = client.CachedModel(depUrl, cachedPath); EXPECT_TRUE(res5); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res5); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, res5.Type()); } // Download model with a dependency specified within its `model.config` @@ -551,28 +551,28 @@ TEST_F(FuelClientTest, DownloadModel) std::string cachedPath; Result res1 = client.CachedModel(url, cachedPath); EXPECT_FALSE(res1); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), res1); + EXPECT_EQ(ResultType::FETCH_ERROR, res1.Type()); // Check the dependency is not cached Result res2 = client.CachedModel(depUrl, cachedPath); EXPECT_FALSE(res2); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), res2); + EXPECT_EQ(ResultType::FETCH_ERROR, res2.Type()); // Download std::string path; Result res3 = client.DownloadModel(url, path); EXPECT_TRUE(res3); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res3); + EXPECT_EQ(ResultType::FETCH, res3.Type()); // Check it is cached Result res4 = client.CachedModel(url, cachedPath); EXPECT_TRUE(res4); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res4); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, res4.Type()); // Check the dependency is cached Result res5 = client.CachedModel(depUrl, cachedPath); EXPECT_TRUE(res5); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res5); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, res5.Type()); } // Try using nonexistent URL @@ -583,7 +583,7 @@ TEST_F(FuelClientTest, DownloadModel) std::string path; Result result = client.DownloadModel(common::URI(url), path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Try using bad URL @@ -592,7 +592,7 @@ TEST_F(FuelClientTest, DownloadModel) std::string path; Result result = client.DownloadModel(common::URI(url), path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } } @@ -619,7 +619,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModel(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "alice", "models", "My Model", "3"), path); } @@ -630,7 +630,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModel(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "alice", "models", "My Model", "3"), path); } @@ -641,7 +641,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModel(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "alice", "models", "My Model", "2"), path); } @@ -653,7 +653,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModelFile(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "alice", "models", "My Model", "3", "model.sdf"), path); } @@ -665,7 +665,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModelFile(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "alice", "models", "My Model", "2", "meshes", "model.dae"), path); } @@ -676,7 +676,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModel(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Non-cached model (when looking for file) @@ -685,7 +685,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModelFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Non-cached model file @@ -696,7 +696,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModelFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Model root URL to model file @@ -705,7 +705,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModelFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Bad model URL @@ -714,7 +714,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModel(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Bad model file URL @@ -723,7 +723,7 @@ TEST_F(FuelClientTest, CachedModel) std::string path; auto result = client.CachedModelFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } } @@ -1019,13 +1019,13 @@ TEST_F(FuelClientTest, DownloadWorld) std::string cachedPath; auto res1 = client.CachedWorld(url, cachedPath); EXPECT_FALSE(res1); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), res1); + EXPECT_EQ(ResultType::FETCH_ERROR, res1.Type()); // Download std::string path; auto res2 = client.DownloadWorld(url, path); EXPECT_TRUE(res2); - EXPECT_EQ(Result(ResultType::FETCH), res2); + EXPECT_EQ(ResultType::FETCH, res2.Type()); // Check it was downloaded to `1` auto worldPath = common::joinPaths(common::cwd(), "test_cache", @@ -1041,7 +1041,7 @@ TEST_F(FuelClientTest, DownloadWorld) // Check it is cached auto res3 = client.CachedWorld(url, cachedPath); EXPECT_TRUE(res3); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), res3); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, res3.Type()); EXPECT_EQ(common::joinPaths(worldPath, "2"), cachedPath); } @@ -1052,7 +1052,7 @@ TEST_F(FuelClientTest, DownloadWorld) std::string path; auto result = client.DownloadWorld(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Try using bad URL @@ -1061,7 +1061,7 @@ TEST_F(FuelClientTest, DownloadWorld) std::string path; auto result = client.DownloadWorld(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } } @@ -1088,7 +1088,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorld(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "banana", "worlds", "My World", "3"), path); } @@ -1099,7 +1099,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorld(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "banana", "worlds", "My World", "3"), path); } @@ -1110,7 +1110,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorld(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "banana", "worlds", "My World", "2"), path); } @@ -1122,7 +1122,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorldFile(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "banana", "worlds", "My World", "3", "strawberry.world"), path); @@ -1135,7 +1135,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorldFile(url, path); EXPECT_TRUE(result); - EXPECT_EQ(Result(ResultType::FETCH_ALREADY_EXISTS), result); + EXPECT_EQ(ResultType::FETCH_ALREADY_EXISTS, result.Type()); EXPECT_EQ(common::joinPaths(common::cwd(), "test_cache", "localhost:8007", "banana", "worlds", "My World", "2", "strawberry.world"), path); @@ -1147,7 +1147,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorld(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Non-cached world (when looking for file) @@ -1157,7 +1157,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorldFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Non-cached world file @@ -1167,7 +1167,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorldFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // World root URL to world file @@ -1176,7 +1176,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorldFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Bad world URL @@ -1185,7 +1185,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorld(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } // Bad world file URL @@ -1194,7 +1194,7 @@ TEST_F(FuelClientTest, CachedWorld) std::string path; auto result = client.CachedWorldFile(url, path); EXPECT_FALSE(result); - EXPECT_EQ(Result(ResultType::FETCH_ERROR), result); + EXPECT_EQ(ResultType::FETCH_ERROR, result.Type()); } }