diff --git a/src/selectors.cpp b/src/selectors.cpp
index dc741a3..8890b58 100644
--- a/src/selectors.cpp
+++ b/src/selectors.cpp
@@ -52,7 +52,7 @@
          m_maxSuffixComponents < 0 &&
          m_publisherPublicKeyLocator.empty() &&
          m_exclude.empty() &&
-         m_childSelector < 0 &&
+         m_childSelector == DEFAULT_CHILD_SELECTOR &&
          !m_mustBeFresh;
 }
 
diff --git a/tests/unit-tests/interest.t.cpp b/tests/unit-tests/interest.t.cpp
index 295af50..6b2f2cf 100644
--- a/tests/unit-tests/interest.t.cpp
+++ b/tests/unit-tests/interest.t.cpp
@@ -544,57 +544,6 @@
   BOOST_CHECK(!i.hasSelectedDelegation());
 }
 
-BOOST_AUTO_TEST_CASE(EncodeChildSelector)
-{
-  Interest i;
-  i.setName("/local/ndn/prefix");
-  i.setNonce(1);
-  BOOST_CHECK_EQUAL(i.getChildSelector(), 0);
-  BOOST_CHECK_THROW(i.setChildSelector(-1), std::invalid_argument);
-  BOOST_CHECK_THROW(i.setChildSelector(2), std::invalid_argument);
-  BOOST_CHECK_NO_THROW(i.setChildSelector(1));
-  BOOST_CHECK_EQUAL(i.getChildSelector(), 1);
-  BOOST_CHECK_NO_THROW(i.setChildSelector(0));
-  BOOST_CHECK_EQUAL(i.getChildSelector(), 0);
-
-  const uint8_t expectedDefault[] = {
-    0x05, 0x1e, // MetaInfo
-          0x07, 0x14, // Name
-                0x08, 0x5, // NameComponent
-                      0x6c, 0x6f, 0x63, 0x61, 0x6c,
-                0x08, 0x3, // NameComponent
-                      0x6e, 0x64, 0x6e,
-                0x08, 0x6, // NameComponent
-                      0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
-          0x09, 0x00, // Selectors
-          0x0a, 0x04, // Nonce
-                0x01, 0x00, 0x00, 0x00, // 1
-  };
-
-  BOOST_CHECK_EQUAL_COLLECTIONS(i.wireEncode().begin(), i.wireEncode().end(),
-                                expectedDefault, expectedDefault + sizeof(expectedDefault));
-
-  const uint8_t expected1[] = {
-    0x05, 0x21, // MetaInfo
-          0x07, 0x14, // Name
-                0x08, 0x5, // NameComponent
-                      0x6c, 0x6f, 0x63, 0x61, 0x6c,
-                0x08, 0x3, // NameComponent
-                      0x6e, 0x64, 0x6e,
-                0x08, 0x6, // NameComponent
-                      0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
-          0x09, 0x03, // Selectors
-                0x11, 0x01, // ChildSelector
-                      0x01, // 1
-          0x0a, 0x04, // Nonce
-                0x01, 0x00, 0x00, 0x00, // 1
-  };
-
-  i.setChildSelector(1);
-  BOOST_CHECK_EQUAL_COLLECTIONS(i.wireEncode().begin(), i.wireEncode().end(),
-                                expected1, expected1 + sizeof(expected1));
-}
-
 BOOST_AUTO_TEST_CASE(EncodeInterestLifetime)
 {
   Interest i;
@@ -608,7 +557,7 @@
   BOOST_CHECK_NO_THROW(i.setInterestLifetime(DEFAULT_INTEREST_LIFETIME));
 
   const uint8_t expectedDefault[] = {
-    0x05, 0x1e, // MetaInfo
+    0x05, 0x1c, // Interest
           0x07, 0x14, // Name
                 0x08, 0x5, // NameComponent
                       0x6c, 0x6f, 0x63, 0x61, 0x6c,
@@ -616,7 +565,6 @@
                       0x6e, 0x64, 0x6e,
                 0x08, 0x6, // NameComponent
                       0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
-          0x09, 0x00, // Selectors
           0x0a, 0x04, // Nonce
                 0x01, 0x00, 0x00, 0x00, // 1
   };
@@ -625,7 +573,7 @@
                                 expectedDefault, expectedDefault + sizeof(expectedDefault));
 
   const uint8_t expected1000ms[] = {
-    0x05, 0x22, // MetaInfo
+    0x05, 0x20, // Interest
           0x07, 0x14, // Name
                 0x08, 0x5, // NameComponent
                       0x6c, 0x6f, 0x63, 0x61, 0x6c,
@@ -633,7 +581,6 @@
                       0x6e, 0x64, 0x6e,
                 0x08, 0x6, // NameComponent
                       0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
-          0x09, 0x00, // Selectors
           0x0a, 0x04, // Nonce
                 0x01, 0x00, 0x00, 0x00, // 1
           0x0c, 0x02, // InterestLifetime
@@ -726,80 +673,6 @@
   BOOST_CHECK_EQUAL(a != b, false);
 }
 
-BOOST_AUTO_TEST_CASE(SelectorsEqualityChecks)
-{
-  // Selectors ::= SELECTORS-TYPE TLV-LENGTH
-  //                 MinSuffixComponents?
-  //                 MaxSuffixComponents?
-  //                 PublisherPublicKeyLocator?
-  //                 Exclude?
-  //                 ChildSelector?
-  //                 MustBeFresh?
-
-  Selectors a;
-  Selectors b;
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  // MinSuffixComponents
-  a.setMinSuffixComponents(1);
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b.setMinSuffixComponents(2);
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b.setMinSuffixComponents(1);
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  // MaxSuffixComponents
-  a.setMaxSuffixComponents(10);
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b.setMaxSuffixComponents(10);
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  // PublisherPublicKeyLocator
-  a.setPublisherPublicKeyLocator(KeyLocator("/key/Locator/name"));
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b.setPublisherPublicKeyLocator(KeyLocator("/key/Locator/name"));
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  // Exclude
-  a.setExclude(Exclude().excludeOne(name::Component("exclude")));
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b.setExclude(Exclude().excludeOne(name::Component("exclude")));
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  // ChildSelector
-  a.setChildSelector(1);
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b.setChildSelector(1);
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-
-  // MustBeFresh
-  a.setMustBeFresh(true);
-  BOOST_CHECK_EQUAL(a == b, false);
-  BOOST_CHECK_EQUAL(a != b, true);
-
-  b.setMustBeFresh(true);
-  BOOST_CHECK_EQUAL(a == b, true);
-  BOOST_CHECK_EQUAL(a != b, false);
-}
-
 BOOST_AUTO_TEST_CASE(LinkObject)
 {
   Link link1("test", {{100, "/test3"}, {20, "/test2"}, {10, "/test1"}});
diff --git a/tests/unit-tests/selectors.t.cpp b/tests/unit-tests/selectors.t.cpp
new file mode 100644
index 0000000..0b5d70f
--- /dev/null
+++ b/tests/unit-tests/selectors.t.cpp
@@ -0,0 +1,199 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2017 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "selectors.hpp"
+
+#include "boost-test.hpp"
+
+namespace ndn {
+namespace tests {
+
+BOOST_AUTO_TEST_SUITE(TestSelectors)
+
+BOOST_AUTO_TEST_CASE(DefaultConstructor)
+{
+  Selectors s;
+  BOOST_CHECK(s.empty());
+  BOOST_CHECK_EQUAL(s.getMinSuffixComponents(), -1);
+  BOOST_CHECK_EQUAL(s.getMaxSuffixComponents(), -1);
+  BOOST_CHECK(s.getPublisherPublicKeyLocator().empty());
+  BOOST_CHECK(s.getExclude().empty());
+  BOOST_CHECK_EQUAL(s.getChildSelector(), 0);
+  BOOST_CHECK_EQUAL(s.getMustBeFresh(), false);
+}
+
+BOOST_AUTO_TEST_CASE(EncodeDecodeEmpty)
+{
+  const uint8_t WIRE[] = {
+    0x09, 0x00 // Selectors
+  };
+
+  Selectors s1;
+  Block wire1 = s1.wireEncode();
+  BOOST_CHECK_EQUAL_COLLECTIONS(wire1.begin(), wire1.end(), WIRE, WIRE + sizeof(WIRE));
+
+  Selectors s2(wire1);
+  BOOST_CHECK(s2.empty());
+  BOOST_CHECK_EQUAL(s2.getMinSuffixComponents(), -1);
+  BOOST_CHECK_EQUAL(s2.getMaxSuffixComponents(), -1);
+  BOOST_CHECK(s2.getPublisherPublicKeyLocator().empty());
+  BOOST_CHECK(s2.getExclude().empty());
+  BOOST_CHECK_EQUAL(s2.getChildSelector(), 0);
+  BOOST_CHECK_EQUAL(s2.getMustBeFresh(), false);
+
+  BOOST_CHECK(s1 == s2);
+}
+
+BOOST_AUTO_TEST_CASE(EncodeDecodeFull)
+{
+  const uint8_t WIRE[] = {
+    0x09, 0x39, // Selectors
+          0x0d, 0x01, 0x02, // MinSuffixComponents
+          0x0e, 0x01, 0x06,  // MaxSuffixComponent
+          0x1c, 0x16, // KeyLocator
+                0x07, 0x14, // Name
+                      0x08, 0x04, 0x74, 0x65, 0x73, 0x74,
+                      0x08, 0x03, 0x6b, 0x65, 0x79,
+                      0x08, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x6f, 0x72,
+          0x10, 0x14, // Exclude
+                0x08, 0x04, 0x61, 0x6c, 0x65, 0x78, // NameComponent
+                0x08, 0x04, 0x78, 0x78, 0x78, 0x78, // NameComponent
+                0x13, 0x00, // Any
+                0x08, 0x04, 0x79, 0x79, 0x79, 0x79, // NameComponent
+          0x11, 0x01, 0x01, // ChildSelector
+          0x12, 0x00 // MustBeFresh
+  };
+
+  Selectors s1;
+  s1.setMinSuffixComponents(2);
+  s1.setMaxSuffixComponents(6);
+  s1.setPublisherPublicKeyLocator(KeyLocator("/test/key/locator"));
+  s1.setExclude(Exclude().excludeOne(name::Component("alex"))
+                .excludeRange(name::Component("xxxx"), name::Component("yyyy")));
+  s1.setChildSelector(1);
+  s1.setMustBeFresh(true);
+
+  Block wire1 = s1.wireEncode();
+  BOOST_CHECK_EQUAL_COLLECTIONS(wire1.begin(), wire1.end(), WIRE, WIRE + sizeof(WIRE));
+
+  Selectors s2(wire1);
+  BOOST_CHECK(!s2.empty());
+  BOOST_CHECK_EQUAL(s2.getMinSuffixComponents(), 2);
+  BOOST_CHECK_EQUAL(s2.getMaxSuffixComponents(), 6);
+  BOOST_CHECK_EQUAL(s2.getPublisherPublicKeyLocator().getType(), KeyLocator::KeyLocator_Name);
+  BOOST_CHECK_EQUAL(s2.getPublisherPublicKeyLocator().getName(), "ndn:/test/key/locator");
+  BOOST_CHECK_EQUAL(s2.getExclude().toUri(), "alex,xxxx,*,yyyy");
+  BOOST_CHECK_EQUAL(s2.getChildSelector(), 1);
+  BOOST_CHECK_EQUAL(s2.getMustBeFresh(), true);
+
+  BOOST_CHECK(s1 == s2);
+}
+
+BOOST_AUTO_TEST_CASE(SetChildSelector)
+{
+  Selectors s;
+  BOOST_CHECK_EQUAL(s.getChildSelector(), 0);
+  BOOST_CHECK_THROW(s.setChildSelector(-1), std::invalid_argument);
+  BOOST_CHECK_THROW(s.setChildSelector(2), std::invalid_argument);
+  s.setChildSelector(1);
+  BOOST_CHECK_EQUAL(s.getChildSelector(), 1);
+  s.setChildSelector(0);
+  BOOST_CHECK_EQUAL(s.getChildSelector(), 0);
+}
+
+BOOST_AUTO_TEST_CASE(Equality)
+{
+  // Selectors ::= SELECTORS-TYPE TLV-LENGTH
+  //                 MinSuffixComponents?
+  //                 MaxSuffixComponents?
+  //                 PublisherPublicKeyLocator?
+  //                 Exclude?
+  //                 ChildSelector?
+  //                 MustBeFresh?
+
+  Selectors a;
+  Selectors b;
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  // MinSuffixComponents
+  a.setMinSuffixComponents(1);
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setMinSuffixComponents(2);
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setMinSuffixComponents(1);
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  // MaxSuffixComponents
+  a.setMaxSuffixComponents(10);
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setMaxSuffixComponents(10);
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  // PublisherPublicKeyLocator
+  a.setPublisherPublicKeyLocator(KeyLocator("/key/Locator/name"));
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setPublisherPublicKeyLocator(KeyLocator("/key/Locator/name"));
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  // Exclude
+  a.setExclude(Exclude().excludeOne(name::Component("exclude")));
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setExclude(Exclude().excludeOne(name::Component("exclude")));
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  // ChildSelector
+  a.setChildSelector(1);
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setChildSelector(1);
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+
+  // MustBeFresh
+  a.setMustBeFresh(true);
+  BOOST_CHECK_EQUAL(a == b, false);
+  BOOST_CHECK_EQUAL(a != b, true);
+
+  b.setMustBeFresh(true);
+  BOOST_CHECK_EQUAL(a == b, true);
+  BOOST_CHECK_EQUAL(a != b, false);
+}
+
+BOOST_AUTO_TEST_SUITE_END() // TestSelectors
+
+} // namespace tests
+} // namespace ndn
