peek: Refactor ndnpeek and add unit tests

Change-Id: Ib34c4431bdc268c5a7ef2fccf0946b0d19d69ab6
Refs: #3558
diff --git a/tools/peek/wscript b/tools/peek/wscript
index 45679a2..f701269 100644
--- a/tools/peek/wscript
+++ b/tools/peek/wscript
@@ -2,14 +2,24 @@
 top = '../..'
 
 def build(bld):
-    bld.program(
-        features='cxx',
-        target='../../bin/ndnpeek',
-        source='ndn-peek.cpp',
+
+    bld(features='cxx',
+        name='peek-ndnpeek-objects',
+        source=bld.path.ant_glob('ndnpeek/*.cpp', excl='ndnpeek/main.cpp'),
         use='core-objects')
 
+    bld(features='cxx cxxprogram',
+        target='../../bin/ndnpeek',
+        source='ndnpeek/main.cpp',
+        use='peek-ndnpeek-objects')
+
     bld.program(
         features='cxx',
         target='../../bin/ndnpoke',
         source='ndn-poke.cpp',
         use='core-objects')
+
+    ## (for unit tests)
+
+    bld(name='peek-objects',
+        use='peek-ndnpeek-objects')