tests/integrated: Basic repo insert, delete and read test case
Integrated tests are separated from unit tests:
* ./build/unit-tests
* ./build/integrated-tests
Change-Id: I766478de6ec4b7925d4d0dd5ec44e7e667de891b
diff --git a/src/storage/sqlite-handle.cpp b/src/storage/sqlite-handle.cpp
index 02598a9..5842947 100644
--- a/src/storage/sqlite-handle.cpp
+++ b/src/storage/sqlite-handle.cpp
@@ -442,6 +442,8 @@
}
else {
if (readNameSelector(interest, names)) {
+ if (names.empty())
+ return false;
if (!filterNameChild(interest.getName(), interest.getChildSelector(), names, resultName)) {
return false;
}
@@ -458,8 +460,10 @@
vector<Name> names;
Name resultName;
readDataName(name, names);
- filterNameChild(name, 0, names, resultName);
- if (!resultName.empty()) {
+ if (names.empty())
+ return false;
+ bool isOk = filterNameChild(name, 0, names, resultName);
+ if (isOk) {
return readData(resultName, data);
}
else
@@ -670,7 +674,12 @@
SqliteHandle::filterNameChild(const Name& name, int childSelector,
const vector<Name>& names, Name& resultName)
{
- if (childSelector == 0) {
+ BOOST_ASSERT(!names.empty());
+
+ if (childSelector < 0) {
+ resultName = *names.begin();
+ }
+ else if (childSelector == 0) {
if (!names.empty()) {
resultName = *std::min_element(names.begin(), names.end());
}
@@ -687,6 +696,7 @@
}
}
else {
+ std::cerr << "Unknown ChildSelector specified" << std::endl;
return false;
}
return true;
@@ -705,6 +715,8 @@
Interest interest(name);
interest.setSelectors(selectors);
readNameSelector(interest, names);
+ if (names.empty())
+ return false;
if (selectors.getChildSelector() >= 0) {
Name resultName;
if (!filterNameChild(name, selectors.getChildSelector(), names, resultName))