catchunks: simplify internal options handling

Change-Id: I537a281f6c996c2544c145ab9cc01a54272c8efa
diff --git a/tests/chunks/consumer.t.cpp b/tests/chunks/consumer.t.cpp
index 84dcb5b..9ae1ad8 100644
--- a/tests/chunks/consumer.t.cpp
+++ b/tests/chunks/consumer.t.cpp
@@ -136,11 +136,7 @@
 class PipelineInterestsDummy : public PipelineInterests
 {
 public:
-  PipelineInterestsDummy(Face& face)
-    : PipelineInterests(face)
-    , isPipelineRunning(false)
-  {
-  }
+  using PipelineInterests::PipelineInterests;
 
 private:
   void
@@ -155,18 +151,19 @@
   }
 
 public:
-  bool isPipelineRunning;
+  bool isPipelineRunning = false;
 };
 
 BOOST_FIXTURE_TEST_CASE(RunBasic, UnitTestTimeFixture)
 {
   boost::asio::io_service io;
   util::DummyClientFace face(io);
+  Options options;
   Consumer consumer(security::v2::getAcceptAllValidator());
 
   Name prefix = Name("/ndn/chunks/test").appendVersion(1);
-  auto discover = make_unique<DiscoverVersion>(prefix, face, Options());
-  auto pipeline = make_unique<PipelineInterestsDummy>(face);
+  auto discover = make_unique<DiscoverVersion>(face, prefix, options);
+  auto pipeline = make_unique<PipelineInterestsDummy>(face, options);
   auto pipelinePtr = pipeline.get();
 
   consumer.run(std::move(discover), std::move(pipeline));
diff --git a/tests/chunks/discover-version.t.cpp b/tests/chunks/discover-version.t.cpp
index 25754fd..eb94f1d 100644
--- a/tests/chunks/discover-version.t.cpp
+++ b/tests/chunks/discover-version.t.cpp
@@ -41,28 +41,18 @@
                                public IdentityManagementFixture
 {
 public:
-  DiscoverVersionFixture()
-    : face(io)
-    , name("/ndn/chunks/test")
-    , isDiscoveryFinished(false)
-    , version(1449227841747)
-  {
-    opt.interestLifetime = ndn::DEFAULT_INTEREST_LIFETIME;
-    opt.maxRetriesOnTimeoutOrNack = 15;
-    opt.isVerbose = false;
-  }
-
   void
   run(const Name& prefix)
   {
     BOOST_REQUIRE(!prefix.empty());
-    discover = make_unique<DiscoverVersion>(prefix, face, opt);
+
+    discover = make_unique<DiscoverVersion>(face, prefix, opt);
     discover->onDiscoverySuccess.connect([this] (const Name& versionedName) {
-      isDiscoveryFinished = true;
       BOOST_REQUIRE(!versionedName.empty() && versionedName[-1].isVersion());
       discoveredVersion = versionedName[-1].toVersion();
+      isDiscoveryFinished = true;
     });
-    discover->onDiscoveryFailure.connect([this] (const std::string& reason) {
+    discover->onDiscoveryFailure.connect([this] (const std::string&) {
       isDiscoveryFinished = true;
     });
 
@@ -72,13 +62,13 @@
 
 protected:
   boost::asio::io_service io;
-  util::DummyClientFace face;
-  Name name;
+  util::DummyClientFace face{io};
+  Name name = "/ndn/chunks/test";
+  Options opt;
   unique_ptr<DiscoverVersion> discover;
   optional<uint64_t> discoveredVersion;
-  bool isDiscoveryFinished;
-  uint64_t version;
-  Options opt;
+  bool isDiscoveryFinished = false;
+  uint64_t version = 1449227841747;
 };
 
 BOOST_AUTO_TEST_SUITE(Chunks)
diff --git a/tests/chunks/pipeline-interests-aimd.t.cpp b/tests/chunks/pipeline-interests-aimd.t.cpp
index d0d0bb0..efb634a 100644
--- a/tests/chunks/pipeline-interests-aimd.t.cpp
+++ b/tests/chunks/pipeline-interests-aimd.t.cpp
@@ -26,7 +26,6 @@
  */
 
 #include "tools/chunks/catchunks/pipeline-interests-aimd.hpp"
-#include "tools/chunks/catchunks/options.hpp"
 
 #include "pipeline-interests-fixture.hpp"
 
@@ -40,9 +39,9 @@
 {
 public:
   PipelineInterestAimdFixture()
-    : opt(makePipelineOptions())
-    , rttEstimator(makeRttEstimatorOptions())
+    : rttEstimator(makeRttEstimatorOptions())
   {
+    opt.isQuiet = true;
     createPipeline();
   }
 
@@ -55,22 +54,6 @@
   }
 
 private:
-  static PipelineInterestsAdaptive::Options
-  makePipelineOptions()
-  {
-    PipelineInterestsAdaptive::Options pipelineOptions;
-    pipelineOptions.isQuiet = true;
-    pipelineOptions.isVerbose = false;
-    pipelineOptions.disableCwa = false;
-    pipelineOptions.ignoreCongMarks = false;
-    pipelineOptions.resetCwndToInit = false;
-    pipelineOptions.initCwnd = 1.0;
-    pipelineOptions.aiStep = 1.0;
-    pipelineOptions.mdCoef = 0.5;
-    pipelineOptions.initSsthresh = std::numeric_limits<int>::max();
-    return pipelineOptions;
-  }
-
   static shared_ptr<RttEstimatorWithStats::Options>
   makeRttEstimatorOptions()
   {
@@ -86,7 +69,7 @@
   }
 
 protected:
-  PipelineInterestsAdaptive::Options opt;
+  Options opt;
   RttEstimatorWithStats rttEstimator;
   PipelineInterestsAdaptive* pipeline;
   static constexpr double MARGIN = 0.001;
diff --git a/tests/chunks/pipeline-interests-cubic.t.cpp b/tests/chunks/pipeline-interests-cubic.t.cpp
index 0d2edf0..6cfa23e 100644
--- a/tests/chunks/pipeline-interests-cubic.t.cpp
+++ b/tests/chunks/pipeline-interests-cubic.t.cpp
@@ -26,7 +26,6 @@
  */
 
 #include "tools/chunks/catchunks/pipeline-interests-cubic.hpp"
-#include "tools/chunks/catchunks/options.hpp"
 
 #include "pipeline-interests-fixture.hpp"
 
@@ -40,9 +39,9 @@
 {
 public:
   PipelineInterestCubicFixture()
-    : opt(makePipelineOptions())
-    , rttEstimator(makeRttEstimatorOptions())
+    : rttEstimator(makeRttEstimatorOptions())
   {
+    opt.isQuiet = true;
     createPipeline();
   }
 
@@ -55,24 +54,6 @@
   }
 
 private:
-  static PipelineInterestsCubic::Options
-  makePipelineOptions()
-  {
-    PipelineInterestsCubic::Options pipelineOptions;
-    pipelineOptions.isQuiet = true;
-    pipelineOptions.isVerbose = false;
-    pipelineOptions.disableCwa = false;
-    pipelineOptions.ignoreCongMarks = false;
-    pipelineOptions.resetCwndToInit = false;
-    pipelineOptions.initCwnd = 1.0;
-    pipelineOptions.aiStep = 1.0;
-    pipelineOptions.mdCoef = 0.5;
-    pipelineOptions.initSsthresh = std::numeric_limits<int>::max();
-    pipelineOptions.cubicBeta = 0.7;
-    pipelineOptions.enableFastConv = false;
-    return pipelineOptions;
-  }
-
   static shared_ptr<RttEstimatorWithStats::Options>
   makeRttEstimatorOptions()
   {
@@ -88,7 +69,7 @@
   }
 
 protected:
-  PipelineInterestsCubic::Options opt;
+  Options opt;
   RttEstimatorWithStats rttEstimator;
   PipelineInterestsCubic* pipeline;
   static constexpr double MARGIN = 0.001;
diff --git a/tests/chunks/pipeline-interests-fixed.t.cpp b/tests/chunks/pipeline-interests-fixed.t.cpp
index 12610be..f4979a2 100644
--- a/tests/chunks/pipeline-interests-fixed.t.cpp
+++ b/tests/chunks/pipeline-interests-fixed.t.cpp
@@ -37,8 +37,11 @@
 {
 public:
   PipelineInterestFixedFixture()
-    : opt(makeOptions())
   {
+    opt.interestLifetime = 1_s;
+    opt.maxRetriesOnTimeoutOrNack = 3;
+    opt.isQuiet = true;
+    opt.maxPipelineSize = 5;
     createPipeline();
   }
 
@@ -50,21 +53,8 @@
     setPipeline(std::move(pline));
   }
 
-private:
-  static PipelineInterestsFixed::Options
-  makeOptions()
-  {
-    PipelineInterestsFixed::Options options;
-    options.isQuiet = true;
-    options.isVerbose = false;
-    options.interestLifetime = time::seconds(1);
-    options.maxRetriesOnTimeoutOrNack = 3;
-    options.maxPipelineSize = 5;
-    return options;
-  }
-
 protected:
-  PipelineInterestsFixed::Options opt;
+  Options opt;
   PipelineInterestsFixed* pipeline;
 };