update sync-core tests
diff --git a/src/sync-core.cc b/src/sync-core.cc
index c325eb1..d90c463 100644
--- a/src/sync-core.cc
+++ b/src/sync-core.cc
@@ -288,7 +288,10 @@
   m_rootHash = m_log.RememberStateInStateLog();
   SyncStateMsgPtr diff = m_log.FindStateDifferences(*oldHash, *m_rootHash);
 
-  m_stateMsgCallback(diff);
+  if (diff->state_size() > 0)
+  {
+    m_stateMsgCallback(diff);
+  }
 }
 
 void
@@ -345,3 +348,9 @@
   bytes.resize(size);
   msg->SerializeToArray(head(bytes), size);
 }
+
+sqlite3_int64
+SyncCore::seq(const Name &name)
+{
+  return m_log.SeqNo(name);
+}
diff --git a/src/sync-core.h b/src/sync-core.h
index 998be7d..d8c9675 100644
--- a/src/sync-core.h
+++ b/src/sync-core.h
@@ -86,9 +86,13 @@
   void
   recover(const HashPtr &hash);
 
+// ------------------ only used in test -------------------------
   HashPtr
   root() { return m_rootHash; }
 
+  sqlite3_int64
+  seq(const Name &name);
+
 protected:
   void
   sendSyncInterest();
diff --git a/src/sync-log.cc b/src/sync-log.cc
index c9f125a..8375142 100644
--- a/src/sync-log.cc
+++ b/src/sync-log.cc
@@ -34,6 +34,7 @@
   cout << q << endl;
 }
 
+
 SyncLog::SyncLog (const boost::filesystem::path &path, const std::string &localName)
   : DbHelper (path)
   , m_localName (localName)
@@ -399,3 +400,19 @@
 
   return msg;
 }
+
+sqlite3_int64
+SyncLog::SeqNo(const Name &name)
+{
+  sqlite3_stmt *stmt;
+  sqlite3_int64 seq = -1;
+  sqlite3_prepare_v2 (m_db, "SELECT seq_no FROM SyncNodes WHERE device_name=?;", -1, &stmt, 0);
+  Ccnx::CcnxCharbufPtr nameBuf = name;
+  sqlite3_bind_blob (stmt, 1, nameBuf->buf (), nameBuf->length (), SQLITE_STATIC);
+  if (sqlite3_step (stmt) == SQLITE_ROW)
+  {
+    seq = sqlite3_column_int64 (stmt, 0);
+  }
+
+  return seq;
+}
diff --git a/src/sync-log.h b/src/sync-log.h
index 3ab8489..0a59516 100644
--- a/src/sync-log.h
+++ b/src/sync-log.h
@@ -74,6 +74,10 @@
   SyncStateMsgPtr
   FindStateDifferences (const Hash &oldHash, const Hash &newHash);  
 
+  //-------- only used in test -----------------
+  sqlite3_int64
+  SeqNo(const Ccnx::Name &name);
+
 protected:
   void
   UpdateDeviceSeqNo (sqlite3_int64 deviceId, sqlite3_int64 seqNo);
diff --git a/test/test-sync-core.cc b/test/test-sync-core.cc
index 6adbfab..fa6eafd 100644
--- a/test/test-sync-core.cc
+++ b/test/test-sync-core.cc
@@ -9,45 +9,16 @@
 
 BOOST_AUTO_TEST_SUITE(SyncCoreTests)
 
-typedef struct
+void callback(const SyncStateMsgPtr &msg)
 {
-  Name deviceName;
-  Name locator;
-  int64_t seq;
-} Result;
-
-Result result1;
-Result result2;
-
-void setResult(const SyncStateMsgPtr &msg, Result &result)
-{
-  if (msg->state_size() > 0)
-  {
-    SyncState state = msg->state(0);
-    string strName = state.name();
-    result.deviceName = Name((const unsigned char *)strName.c_str(), strName.size());
-    string strLoc = state.locator();
-    result.locator = Name((const unsigned char *)strLoc.c_str(), strLoc.size());
-    result.seq = state.seq();
-  }
-  else
-  {
-    cout << "Msg state size: " << msg->state_size() << endl;
-  }
+  BOOST_CHECK(msg->state_size() > 0);
 }
 
-void callback1(const SyncStateMsgPtr &msg)
+void checkRoots(const HashPtr &root1, const HashPtr &root2)
 {
-  setResult(msg, result1);
+  BOOST_CHECK_EQUAL(*root1, *root2);
 }
 
-void callback2(const SyncStateMsgPtr &msg)
-{
-  setResult(msg, result2);
-}
-
-
-
 BOOST_AUTO_TEST_CASE(SyncCoreTest)
 {
   string dir = "./SyncCoreTest";
@@ -68,43 +39,37 @@
     remove_all(d);
   }
 
-  SyncCore *core1 = new SyncCore(dir1, user1, loc1, syncPrefix, bind(callback1, _1), c1);
+  SyncCore *core1 = new SyncCore(dir1, user1, loc1, syncPrefix, bind(callback, _1), c1);
   usleep(10000);
-  SyncCore *core2 = new SyncCore(dir2, user2, loc2, syncPrefix, bind(callback2, _1), c2);
+  SyncCore *core2 = new SyncCore(dir2, user2, loc2, syncPrefix, bind(callback, _1), c2);
   usleep(1000000);
-
-  SyncState state;
-
-  HashPtr root1 = core1->root();
-  HashPtr root2 = core2->root();
-  BOOST_CHECK_EQUAL(*root1, *root2);
+  checkRoots(core1->root(), core2->root());
 
   cout << "\n\n\n\n\n\n----------\n";
   core1->updateLocalState(1);
   usleep(100000);
-  BOOST_CHECK_EQUAL(result2.seq, 1);
-  BOOST_CHECK_EQUAL(result2.deviceName, user1);
-  BOOST_CHECK_EQUAL(result2.locator, loc1);
+  checkRoots(core1->root(), core2->root());
+  BOOST_CHECK_EQUAL(core2->seq(user1), 1);
 
   core1->updateLocalState(5);
   usleep(100000);
-  BOOST_CHECK_EQUAL(result2.seq, 5);
+  checkRoots(core1->root(), core2->root());
+  BOOST_CHECK_EQUAL(core2->seq(user1), 5);
 
   core2->updateLocalState(10);
   usleep(100000);
-  BOOST_CHECK_EQUAL(result1.seq, 10);
-  BOOST_CHECK_EQUAL(result1.deviceName, user2);
-  BOOST_CHECK_EQUAL(result1.locator, loc2);
+  checkRoots(core1->root(), core2->root());
+  BOOST_CHECK_EQUAL(core1->seq(user2), 10);
 
   // simple simultaneous data generation
   cout << "\n\n\n\n\n\n----------Simultaneous\n";
   core1->updateLocalState(11);
-  // change the value here 100, 2000, 3000, 5000, each with different error (for 2000 and 3000 run at least 3 times)
   usleep(100);
-  core2->updateLocalState(12);
+  core2->updateLocalState(15);
   usleep(1000000);
-  BOOST_CHECK_EQUAL(result1.seq, 12);
-  BOOST_CHECK_EQUAL(result2.seq, 11);
+  checkRoots(core1->root(), core2->root());
+  BOOST_CHECK_EQUAL(core1->seq(user2), 15);
+  BOOST_CHECK_EQUAL(core2->seq(user1), 11);
 
   // clean the test dir
   if (exists(d))