diff options
author | Dan Goodliffe <daniel.goodliffe@pressassociation.com> | 2017-07-12 12:13:02 +0100 |
---|---|---|
committer | Dan Goodliffe <daniel.goodliffe@pressassociation.com> | 2017-07-12 12:13:02 +0100 |
commit | 690ae9759609fc1b50b8d75b219ec34a90d50484 (patch) | |
tree | 666ab04db255ad62ae759147467c0c91b21ae133 | |
parent | Add icetray-doc to tool install rules (diff) | |
download | icetray-690ae9759609fc1b50b8d75b219ec34a90d50484.tar.bz2 icetray-690ae9759609fc1b50b8d75b219ec34a90d50484.tar.xz icetray-690ae9759609fc1b50b8d75b219ec34a90d50484.zip |
Test options with more realistic DryIce
-rw-r--r-- | icetray/unittests/testIceTrayOptions.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/icetray/unittests/testIceTrayOptions.cpp b/icetray/unittests/testIceTrayOptions.cpp index a8fe157..22776b9 100644 --- a/icetray/unittests/testIceTrayOptions.cpp +++ b/icetray/unittests/testIceTrayOptions.cpp @@ -6,26 +6,31 @@ #include <Ice/ObjectAdapter.h> #include <Ice/Initialize.h> #include "icetrayService.h" +#include "dryice.h" class TestService : public IceTray::Service { public: void addObjects(const std::string &, const Ice::CommunicatorPtr &, const Ice::StringSeq &, const Ice::ObjectAdapterPtr &) { + // Verifies option resolution is available for addObjects. + IceTray::OptionsResolver<TestOptions> myOpts; } }; +NAMEDFACTORY("default", TestService, IceTray::ServiceFactory); + +class DI : public IceTray::DryIce { + public: + DI() : IceTray::DryIce({ + "--testInt=3", + "--vec=1,2,4,8" + }) + { + } +}; +BOOST_GLOBAL_FIXTURE(DI); BOOST_AUTO_TEST_CASE( testOptions ) { - auto ic = Ice::initialize(); - auto p = ic->getProperties(); - p->setProperty("test.Endpoints", "default"); - p->setProperty("testInt", "3"); - p->setProperty("vec", "1,2,4,8"); - BOOST_REQUIRE_EQUAL(4, p->getPropertyAsList("vec").size()); - - TestService ts; - ts.start("", ic, {}); - IceTray::OptionsResolver<TestOptions> myOpts; BOOST_REQUIRE_EQUAL(3, myOpts->testInt); BOOST_REQUIRE_EQUAL("some string", myOpts->testString); @@ -34,8 +39,5 @@ BOOST_AUTO_TEST_CASE( testOptions ) BOOST_REQUIRE_EQUAL(2, myOpts->testVec[1]); BOOST_REQUIRE_EQUAL(4, myOpts->testVec[2]); BOOST_REQUIRE_EQUAL(8, myOpts->testVec[3]); - - ts.stop(); - ic->destroy(); } |