Propagate error code in test
This commit is contained in:
@@ -540,6 +540,7 @@ void checkParentPointers(Node *node, bool &success) {
|
||||
fprintf(stderr, "%.*s child %d has parent pointer %p. Expected %p\n",
|
||||
node->len, (const char *)(node + 1), i,
|
||||
(void *)node->child[i]->parent, (void *)node);
|
||||
success = false;
|
||||
}
|
||||
checkParentPointers(node->child[i], success);
|
||||
}
|
||||
@@ -556,8 +557,8 @@ int64_t checkMaxVersion(Node *node, bool &success) {
|
||||
if (node->maxVersion != expected) {
|
||||
fprintf(stderr, "%.*s has max version %d. Expected %d\n", node->len,
|
||||
(const char *)(node + 1), int(node->maxVersion), int(expected));
|
||||
}
|
||||
success = false;
|
||||
}
|
||||
return expected;
|
||||
}
|
||||
|
||||
@@ -623,8 +624,8 @@ struct ConflictSet::Impl {
|
||||
}
|
||||
|
||||
struct StepwiseInsert {
|
||||
// Search phase state. After this phase, the heap invariant may be violated
|
||||
// for (*current)->parent.
|
||||
// After this phase, the heap invariant may be violated for
|
||||
// (*current)->parent.
|
||||
Node **current;
|
||||
Node *parent;
|
||||
const Key *key;
|
||||
@@ -643,7 +644,7 @@ struct ConflictSet::Impl {
|
||||
if (*current == nullptr) {
|
||||
auto *newNode = createNode(*key, parent, writeVersion);
|
||||
*current = newNode;
|
||||
// We could interleave the iteration in next, but we'd need a careful
|
||||
// We could interleave the iteration in ::next, but we'd need a careful
|
||||
// analysis for correctness and it's unlikely to be worthwhile.
|
||||
auto *prev = ::next(newNode, false);
|
||||
assert(prev != nullptr);
|
||||
@@ -797,6 +798,7 @@ int main(void) {
|
||||
}
|
||||
cs.addWrites(write, kNumKeys);
|
||||
debugPrintDot(stdout, cs.root);
|
||||
checkInvariants(cs.root);
|
||||
bool success = checkInvariants(cs.root);
|
||||
return success ? 0 : 1;
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user