From c379a9e5f031dfafa0dc0e132061610b706a7b28 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Tue, 9 Dec 2014 23:30:51 +0100 Subject: got a trivial version of the ResourceLocator to work. --- test/core/ResourceLocatorTest.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'test/core/ResourceLocatorTest.cpp') diff --git a/test/core/ResourceLocatorTest.cpp b/test/core/ResourceLocatorTest.cpp index 08259b6..a3860c5 100644 --- a/test/core/ResourceLocatorTest.cpp +++ b/test/core/ResourceLocatorTest.cpp @@ -24,28 +24,33 @@ namespace ousia { -//TODO: This does not work yet! - class TestResourceLocator : public ResourceLocator { - ResourceLocation locate(const std::string &path, - const std::string &relativeTo, - const ResourceType type) const override +public: + ResourceLocator::Location locate( + const std::string &path, const std::string &relativeTo, + const ResourceLocator::Type type) const override { // trivial test implementation. - return ResourceLocation(true, *this, type, path); + return ResourceLocator::Location(true, *this, type, path); } - std::istream stream(const std::string &location) const override { - //trivial test implementation. - std::stringstream ss; - ss << "test"; + std::unique_ptr stream( + const std::string &location) const override + { + // trivial test implementation. + std::unique_ptr ss(new std::stringstream()); + (*ss) << "test"; return std::move(ss); } - }; TEST(ResourceLocator, locate) { - + TestResourceLocator instance; + ResourceLocator::Location location = + instance.locate("path", "", ResourceLocator::Type::DOMAIN); + ASSERT_TRUE(location.found); + ASSERT_EQ(ResourceLocator::Type::DOMAIN, location.type); + ASSERT_EQ("path", location.location); } } -- cgit v1.2.3