fix some errors in tests

Change-Id: I8f160bd9f555cac5999765e0fcb83fa78c9feffe
diff --git a/src/name-assignments/assignment-funcs.cpp b/src/name-assignments/assignment-funcs.cpp
index 501c510..50c8df1 100644
--- a/src/name-assignments/assignment-funcs.cpp
+++ b/src/name-assignments/assignment-funcs.cpp
@@ -27,13 +27,17 @@
 NameAssignmentFuncFactory::NameAssignmentFuncFactory(const std::string& factoryType, const std::string& format)
   : FACTORY_TYPE(factoryType)
 {
-  auto s = format;
-  size_t pos = 0;
-  while ((pos = s.find("/")) != std::string::npos) {
-    m_nameFormat.push_back(s.substr(0, pos));
-    s.erase(0, pos + 1);
+  size_t index = 0, startIndex = 0;
+  while ((index = format.find("/", startIndex)) != std::string::npos) {
+    auto component = format.substr(startIndex, index - startIndex);
+    if (!component.empty()) {
+      m_nameFormat.push_back(component);
+    }
+    startIndex = index + 1;
   }
-  m_nameFormat.push_back(s);
+  if (startIndex != format.size()) {
+    m_nameFormat.push_back(format.substr(startIndex));
+  }
 }
 
 unique_ptr<NameAssignmentFuncFactory>