diff --git a/tests/daemon/table/cs.t.cpp b/tests/daemon/table/cs.t.cpp
index db980d2..85886da 100644
--- a/tests/daemon/table/cs.t.cpp
+++ b/tests/daemon/table/cs.t.cpp
@@ -25,106 +25,18 @@
 
 #include "table/cs.hpp"
 
-#include "tests/test-common.hpp"
-#include "tests/daemon/global-io-fixture.hpp"
+#include "tests/daemon/table/cs-fixture.hpp"
 
-#include <cstring>
-
-#include <ndn-cxx/exclude.hpp>
 #include <ndn-cxx/lp/tags.hpp>
-#include <ndn-cxx/util/sha256.hpp>
 
 namespace nfd {
 namespace cs {
 namespace tests {
 
-using namespace nfd::tests;
-
-#define CHECK_CS_FIND(expected) find([&] (uint32_t found) { BOOST_CHECK_EQUAL(expected, found); });
-
 BOOST_AUTO_TEST_SUITE(Table)
-BOOST_FIXTURE_TEST_SUITE(TestCs, GlobalIoFixture)
+BOOST_FIXTURE_TEST_SUITE(TestCs, CsFixture)
 
-class FindFixture : public GlobalIoTimeFixture
-{
-protected:
-  Name
-  insert(uint32_t id, const Name& name, const std::function<void(Data&)>& modifyData = nullptr)
-  {
-    shared_ptr<Data> data = makeData(name);
-    data->setContent(reinterpret_cast<const uint8_t*>(&id), sizeof(id));
-
-    if (modifyData != nullptr) {
-      modifyData(*data);
-    }
-
-    data->wireEncode();
-    m_cs.insert(*data);
-
-    return data->getFullName();
-  }
-
-  Interest&
-  startInterest(const Name& name)
-  {
-    m_interest = make_shared<Interest>(name);
-    return *m_interest;
-  }
-
-  void
-  find(const std::function<void(uint32_t)>& check)
-  {
-    bool hasResult = false;
-    m_cs.find(*m_interest,
-              [&] (const Interest& interest, const Data& data) {
-                hasResult = true;
-                const Block& content = data.getContent();
-                uint32_t found = 0;
-                std::memcpy(&found, content.value(), sizeof(found));
-                check(found);
-              },
-              bind([&] {
-                hasResult = true;
-                check(0);
-              }));
-
-    // current Cs::find implementation is synchronous
-    BOOST_CHECK(hasResult);
-  }
-
-  size_t
-  erase(const Name& prefix, size_t limit)
-  {
-    optional<size_t> nErased;
-    m_cs.erase(prefix, limit, [&] (size_t nErased1) { nErased = nErased1; });
-
-    // current Cs::erase implementation is synchronous
-    // if callback was not invoked, bad_optional_access would occur
-    return *nErased;
-  }
-
-protected:
-  Cs m_cs;
-  shared_ptr<Interest> m_interest;
-};
-
-BOOST_FIXTURE_TEST_SUITE(Find, FindFixture)
-
-BOOST_AUTO_TEST_CASE(EmptyDataName)
-{
-  insert(1, "/");
-
-  startInterest("/");
-  CHECK_CS_FIND(1);
-}
-
-BOOST_AUTO_TEST_CASE(EmptyInterestName)
-{
-  insert(1, "/A");
-
-  startInterest("/");
-  CHECK_CS_FIND(1);
-}
+BOOST_AUTO_TEST_SUITE(Find)
 
 BOOST_AUTO_TEST_CASE(ExactName)
 {
@@ -138,6 +50,19 @@
   CHECK_CS_FIND(2);
 }
 
+BOOST_AUTO_TEST_CASE(ExactName_CanBePrefix)
+{
+  insert(1, "/");
+  insert(2, "/A");
+  insert(3, "/A/B");
+  insert(4, "/A/C");
+  insert(5, "/D");
+
+  startInterest("/A")
+    .setCanBePrefix(true);
+  CHECK_CS_FIND(2);
+}
+
 BOOST_AUTO_TEST_CASE(FullName)
 {
   Name n1 = insert(1, "/A");
@@ -150,20 +75,19 @@
   CHECK_CS_FIND(2);
 }
 
-BOOST_AUTO_TEST_CASE(Leftmost)
+BOOST_AUTO_TEST_CASE(FullName_EmptyDataName)
 {
-  insert(1, "/A");
-  insert(2, "/B/p/1");
-  insert(3, "/B/p/2");
-  insert(4, "/B/q/1");
-  insert(5, "/B/q/2");
-  insert(6, "/C");
+  Name n1 = insert(1, "/");
+  Name n2 = insert(2, "/");
 
-  startInterest("/B");
+  startInterest(n1);
+  CHECK_CS_FIND(1);
+
+  startInterest(n2);
   CHECK_CS_FIND(2);
 }
 
-BOOST_AUTO_TEST_CASE(Rightmost)
+BOOST_AUTO_TEST_CASE(PrefixName)
 {
   insert(1, "/A");
   insert(2, "/B/p/1");
@@ -173,102 +97,18 @@
   insert(6, "/C");
 
   startInterest("/B")
-    .setChildSelector(1);
-  CHECK_CS_FIND(4);
+    .setCanBePrefix(true);
+  CHECK_CS_FIND(2);
 }
 
-BOOST_AUTO_TEST_CASE(MinSuffixComponents)
+BOOST_AUTO_TEST_CASE(PrefixName_NoCanBePrefix)
 {
-  insert(1, "/");
-  insert(2, "/A");
-  insert(3, "/B/1");
-  insert(4, "/C/1/2");
-  insert(5, "/D/1/2/3");
-  insert(6, "/E/1/2/3/4");
+  insert(1, "/B/p/1");
 
-  startInterest("/")
-    .setMinSuffixComponents(0);
-  CHECK_CS_FIND(1);
-
-  startInterest("/")
-    .setMinSuffixComponents(1);
-  CHECK_CS_FIND(1);
-
-  startInterest("/")
-    .setMinSuffixComponents(2);
-  CHECK_CS_FIND(2);
-
-  startInterest("/")
-    .setMinSuffixComponents(3);
-  CHECK_CS_FIND(3);
-
-  startInterest("/")
-    .setMinSuffixComponents(4);
-  CHECK_CS_FIND(4);
-
-  startInterest("/")
-    .setMinSuffixComponents(5);
-  CHECK_CS_FIND(5);
-
-  startInterest("/")
-    .setMinSuffixComponents(6);
-  CHECK_CS_FIND(6);
-
-  startInterest("/")
-    .setMinSuffixComponents(7);
+  startInterest("/B");
   CHECK_CS_FIND(0);
 }
 
-BOOST_AUTO_TEST_CASE(MaxSuffixComponents)
-{
-  insert(1, "/");
-  insert(2, "/A");
-  insert(3, "/B/2");
-  insert(4, "/C/2/3");
-  insert(5, "/D/2/3/4");
-  insert(6, "/E/2/3/4/5");
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(0);
-  CHECK_CS_FIND(0);
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(1);
-  CHECK_CS_FIND(1);
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(2);
-  CHECK_CS_FIND(2);
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(3);
-  CHECK_CS_FIND(3);
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(4);
-  CHECK_CS_FIND(4);
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(5);
-  CHECK_CS_FIND(5);
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(6);
-  CHECK_CS_FIND(6);
-
-  startInterest("/")
-    .setChildSelector(1)
-    .setMaxSuffixComponents(7);
-  CHECK_CS_FIND(6);
-}
-
 BOOST_AUTO_TEST_CASE(MustBeFresh)
 {
   insert(1, "/A/1"); // omitted FreshnessPeriod means FreshnessPeriod = 0 ms
@@ -278,107 +118,34 @@
 
   // lookup at exact same moment as insertion is not tested because this won't happen in reality
 
-  this->advanceClocks(500_ms); // @500ms
+  advanceClocks(500_ms); // @500ms
   startInterest("/A")
+    .setCanBePrefix(true)
     .setMustBeFresh(true);
   CHECK_CS_FIND(3);
 
-  this->advanceClocks(1500_ms); // @2s
+  advanceClocks(1500_ms); // @2s
   startInterest("/A")
+    .setCanBePrefix(true)
     .setMustBeFresh(true);
   CHECK_CS_FIND(4);
 
-  this->advanceClocks(3500_s); // @3502s
+  advanceClocks(3500_s); // @3502s
   startInterest("/A")
+    .setCanBePrefix(true)
     .setMustBeFresh(true);
   CHECK_CS_FIND(4);
 
-  this->advanceClocks(3500_s); // @7002s
+  advanceClocks(3500_s); // @7002s
   startInterest("/A")
+    .setCanBePrefix(true)
     .setMustBeFresh(true);
   CHECK_CS_FIND(0);
 }
 
-BOOST_AUTO_TEST_CASE(DigestOrder)
-{
-  Name n1 = insert(1, "/A");
-  Name n2 = insert(2, "/A");
-
-  uint32_t expectedLeftmost = 0, expectedRightmost = 0;
-  if (n1 < n2) {
-    expectedLeftmost = 1;
-    expectedRightmost = 2;
-  }
-  else {
-    BOOST_CHECK_MESSAGE(n1 != n2, "implicit digest collision detected");
-    expectedLeftmost = 2;
-    expectedRightmost = 1;
-  }
-
-  startInterest("/A")
-    .setChildSelector(0);
-  CHECK_CS_FIND(expectedLeftmost);
-  startInterest("/A")
-    .setChildSelector(1);
-  CHECK_CS_FIND(expectedRightmost);
-}
-
-BOOST_AUTO_TEST_CASE(DigestExclude)
-{
-  insert(1, "/A");
-  Name n2 = insert(2, "/A");
-  insert(3, "/A/B");
-
-  uint8_t digest00[ndn::util::Sha256::DIGEST_SIZE];
-  std::fill_n(digest00, sizeof(digest00), 0x00);
-  uint8_t digestFF[ndn::util::Sha256::DIGEST_SIZE];
-  std::fill_n(digestFF, sizeof(digestFF), 0xFF);
-
-  ndn::Exclude excludeDigest;
-  excludeDigest.excludeRange(
-    name::Component::fromImplicitSha256Digest(digest00, sizeof(digest00)),
-    name::Component::fromImplicitSha256Digest(digestFF, sizeof(digestFF)));
-
-  startInterest("/A")
-    .setChildSelector(0)
-    .setExclude(excludeDigest);
-  CHECK_CS_FIND(3);
-
-  startInterest("/A")
-    .setChildSelector(1)
-    .setExclude(excludeDigest);
-  CHECK_CS_FIND(3);
-
-  ndn::Exclude excludeGeneric;
-  excludeGeneric.excludeAfter(name::Component(static_cast<uint8_t*>(nullptr), 0));
-
-  startInterest("/A")
-    .setChildSelector(0)
-    .setExclude(excludeGeneric);
-  find([] (uint32_t found) { BOOST_CHECK(found == 1 || found == 2); });
-
-  startInterest("/A")
-    .setChildSelector(1)
-    .setExclude(excludeGeneric);
-  find([] (uint32_t found) { BOOST_CHECK(found == 1 || found == 2); });
-
-  ndn::Exclude exclude2 = excludeGeneric;
-  exclude2.excludeOne(n2.get(-1));
-
-  startInterest("/A")
-    .setChildSelector(0)
-    .setExclude(exclude2);
-  CHECK_CS_FIND(1);
-
-  startInterest("/A")
-    .setChildSelector(1)
-    .setExclude(exclude2);
-  CHECK_CS_FIND(1);
-}
-
 BOOST_AUTO_TEST_SUITE_END() // Find
 
-BOOST_FIXTURE_TEST_CASE(Erase, FindFixture)
+BOOST_AUTO_TEST_CASE(Erase)
 {
   insert(1, "/A/B/1");
   insert(2, "/A/B/2");
@@ -386,10 +153,10 @@
   insert(4, "/A/C/4");
   insert(5, "/D/5");
   insert(6, "/E/6");
-  BOOST_CHECK_EQUAL(m_cs.size(), 6);
+  BOOST_CHECK_EQUAL(cs.size(), 6);
 
   BOOST_CHECK_EQUAL(erase("/A", 3), 3);
-  BOOST_CHECK_EQUAL(m_cs.size(), 3);
+  BOOST_CHECK_EQUAL(cs.size(), 3);
   int nDataUnderA = 0;
   startInterest("/A/B/1");
   find([&] (uint32_t found) { nDataUnderA += static_cast<int>(found > 0); });
@@ -402,42 +169,42 @@
   BOOST_CHECK_EQUAL(nDataUnderA, 1);
 
   BOOST_CHECK_EQUAL(erase("/D", 2), 1);
-  BOOST_CHECK_EQUAL(m_cs.size(), 2);
+  BOOST_CHECK_EQUAL(cs.size(), 2);
   startInterest("/D/5");
   CHECK_CS_FIND(0);
 
   BOOST_CHECK_EQUAL(erase("/F", 2), 0);
-  BOOST_CHECK_EQUAL(m_cs.size(), 2);
+  BOOST_CHECK_EQUAL(cs.size(), 2);
 }
 
 // When the capacity limit is set to zero, Data cannot be inserted;
 // this test case covers this situation.
 // The behavior of non-zero capacity limit depends on the eviction policy,
 // and is tested in policy test suites.
-BOOST_FIXTURE_TEST_CASE(ZeroCapacity, FindFixture)
+BOOST_AUTO_TEST_CASE(ZeroCapacity)
 {
-  m_cs.setLimit(0);
+  cs.setLimit(0);
 
-  BOOST_CHECK_EQUAL(m_cs.getLimit(), 0);
-  BOOST_CHECK_EQUAL(m_cs.size(), 0);
-  BOOST_CHECK(m_cs.begin() == m_cs.end());
+  BOOST_CHECK_EQUAL(cs.getLimit(), 0);
+  BOOST_CHECK_EQUAL(cs.size(), 0);
+  BOOST_CHECK(cs.begin() == cs.end());
 
   insert(1, "/A");
-  BOOST_CHECK_EQUAL(m_cs.size(), 0);
+  BOOST_CHECK_EQUAL(cs.size(), 0);
 
   startInterest("/A");
   CHECK_CS_FIND(0);
 }
 
-BOOST_FIXTURE_TEST_CASE(EnablementFlags, FindFixture)
+BOOST_AUTO_TEST_CASE(EnablementFlags)
 {
-  BOOST_CHECK_EQUAL(m_cs.shouldAdmit(), true);
-  BOOST_CHECK_EQUAL(m_cs.shouldServe(), true);
+  BOOST_CHECK_EQUAL(cs.shouldAdmit(), true);
+  BOOST_CHECK_EQUAL(cs.shouldServe(), true);
 
   insert(1, "/A");
-  m_cs.enableAdmit(false);
+  cs.enableAdmit(false);
   insert(2, "/B");
-  m_cs.enableAdmit(true);
+  cs.enableAdmit(true);
   insert(3, "/C");
 
   startInterest("/A");
@@ -447,20 +214,20 @@
   startInterest("/C");
   CHECK_CS_FIND(3);
 
-  m_cs.enableServe(false);
+  cs.enableServe(false);
   startInterest("/A");
   CHECK_CS_FIND(0);
   startInterest("/C");
   CHECK_CS_FIND(0);
 
-  m_cs.enableServe(true);
+  cs.enableServe(true);
   startInterest("/A");
   CHECK_CS_FIND(1);
   startInterest("/C");
   CHECK_CS_FIND(3);
 }
 
-BOOST_FIXTURE_TEST_CASE(CachePolicyNoCache, FindFixture)
+BOOST_AUTO_TEST_CASE(CachePolicyNoCache)
 {
   insert(1, "/A", [] (Data& data) {
     data.setTag(make_shared<lp::CachePolicyTag>(
@@ -473,8 +240,6 @@
 
 BOOST_AUTO_TEST_CASE(Enumeration)
 {
-  Cs cs;
-
   Name nameA("/A");
   Name nameAB("/A/B");
   Name nameABC("/A/B/C");
@@ -483,7 +248,7 @@
   BOOST_CHECK_EQUAL(cs.size(), 0);
   BOOST_CHECK(cs.begin() == cs.end());
 
-  cs.insert(*makeData(nameABC));
+  insert(123, nameABC);
   BOOST_CHECK_EQUAL(cs.size(), 1);
   BOOST_CHECK(cs.begin() != cs.end());
   BOOST_CHECK(cs.begin()->getName() == nameABC);
@@ -495,9 +260,9 @@
   BOOST_CHECK(j++ == cs.begin());
   BOOST_CHECK(j == cs.end());
 
-  cs.insert(*makeData(nameA));
-  cs.insert(*makeData(nameAB));
-  cs.insert(*makeData(nameD));
+  insert(1, nameA);
+  insert(12, nameAB);
+  insert(4, nameD);
 
   std::set<Name> expected = {nameA, nameAB, nameABC, nameD};
   std::set<Name> actual;
