encoding: Optimized encoding of Interest and related data structures

Change-Id: I0609b40565835568e09c3cc0330db441fd9243b6
refs: #1172
diff --git a/tests/test-command-interest.cpp b/tests/test-command-interest.cpp
index 59619ca..fb447d9 100644
--- a/tests/test-command-interest.cpp
+++ b/tests/test-command-interest.cpp
@@ -63,7 +63,12 @@
   shared_ptr<Interest> commandInterest2 = make_shared<Interest>("/TestCommandInterest/Validation/Command2");
   int64_t timestamp = time::now() / 1000000;
   timestamp -= 5000;
-  commandInterest2->getName().append(name::Component::fromNumber(timestamp)).append(name::Component::fromNumber(random::generateWord64()));
+  Name commandName = commandInterest2->getName();
+  commandName
+    .append(name::Component::fromNumber(timestamp))
+    .append(name::Component::fromNumber(random::generateWord64()));
+  commandInterest2->setName(commandName);
+  
   keyChain.signByIdentity(*commandInterest2, identity);
   validator.validate(*commandInterest2,
   		     bind(&TestCore::validated, &core, _1),
diff --git a/tests/test-interest.cpp b/tests/test-interest.cpp
index 2c8f772..df0cdf3 100644
--- a/tests/test-interest.cpp
+++ b/tests/test-interest.cpp
@@ -89,9 +89,11 @@
   i.setMaxSuffixComponents(1);
   i.setChildSelector(1);
   i.setMustBeFresh(false);
-  i.getExclude()
+  Exclude exclude;
+  exclude
     .excludeOne(name::Component("alex"))
     .excludeRange(name::Component("xxxx"), name::Component("yyyy"));
+  i.setExclude(exclude);
   i.setNonce(1);
 
   const Block &wire = i.wireEncode();