Test output improvements.
This commit is contained in:
parent
9ab69b5cb1
commit
b0ec76d401
|
@ -994,7 +994,10 @@ struct DeltaTree2 {
|
||||||
public:
|
public:
|
||||||
struct DecodeCache : FastAllocated<DecodeCache> {
|
struct DecodeCache : FastAllocated<DecodeCache> {
|
||||||
DecodeCache(const T& lowerBound = T(), const T& upperBound = T())
|
DecodeCache(const T& lowerBound = T(), const T& upperBound = T())
|
||||||
: lowerBound(arena, lowerBound), upperBound(arena, upperBound) {}
|
: lowerBound(arena, lowerBound), upperBound(arena, upperBound) {
|
||||||
|
partials.reserve(10);
|
||||||
|
printf("size: %d\n", sizeof(OffsetPartial));
|
||||||
|
}
|
||||||
|
|
||||||
Arena arena;
|
Arena arena;
|
||||||
T lowerBound;
|
T lowerBound;
|
||||||
|
|
|
@ -7139,9 +7139,7 @@ struct IntIntPair {
|
||||||
IntIntPair apply(const Partial& cache) { return cache; }
|
IntIntPair apply(const Partial& cache) { return cache; }
|
||||||
|
|
||||||
IntIntPair apply(Arena& arena, const IntIntPair& base, Optional<Partial>& cache) {
|
IntIntPair apply(Arena& arena, const IntIntPair& base, Optional<Partial>& cache) {
|
||||||
if (!cache.present()) {
|
cache = IntIntPair(base.k + dk, base.v + dv);
|
||||||
cache = IntIntPair(base.k + dk, base.v + dv);
|
|
||||||
}
|
|
||||||
return cache.get();
|
return cache.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7802,7 +7800,7 @@ TEST_CASE("/redwood/correctness/unit/deltaTree/IntIntPair") {
|
||||||
|
|
||||||
auto printItems = [&] {
|
auto printItems = [&] {
|
||||||
for (int k = 0; k < items.size(); ++k) {
|
for (int k = 0; k < items.size(); ++k) {
|
||||||
printf("%d/%d %s\n", k + 1, items.size(), items[k].toString().c_str());
|
debug_printf("%d/%d %s\n", k + 1, items.size(), items[k].toString().c_str());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7812,14 +7810,14 @@ TEST_CASE("/redwood/correctness/unit/deltaTree/IntIntPair") {
|
||||||
(int)tree->size(),
|
(int)tree->size(),
|
||||||
(int)tree->initialHeight,
|
(int)tree->initialHeight,
|
||||||
(int)tree->maxHeight);
|
(int)tree->maxHeight);
|
||||||
debug_printf_always("Data(%p): %s\n", tree, StringRef((uint8_t*)tree, tree->size()).toHexString().c_str());
|
debug_printf("Data(%p): %s\n", tree, StringRef((uint8_t*)tree, tree->size()).toHexString().c_str());
|
||||||
|
|
||||||
printf("DeltaTree2: Count=%d Size=%d InitialHeight=%d MaxHeight=%d\n",
|
printf("DeltaTree2: Count=%d Size=%d InitialHeight=%d MaxHeight=%d\n",
|
||||||
(int)tree2->numItems,
|
(int)tree2->numItems,
|
||||||
(int)tree2->size(),
|
(int)tree2->size(),
|
||||||
(int)tree2->initialHeight,
|
(int)tree2->initialHeight,
|
||||||
(int)tree2->maxHeight);
|
(int)tree2->maxHeight);
|
||||||
debug_printf_always("Data(%p): %s\n", tree2, StringRef((uint8_t*)tree2, tree2->size()).toHexString().c_str());
|
debug_printf("Data(%p): %s\n", tree2, StringRef((uint8_t*)tree2, tree2->size()).toHexString().c_str());
|
||||||
};
|
};
|
||||||
|
|
||||||
// Iterate through items and tree forward and backward, verifying tree contents.
|
// Iterate through items and tree forward and backward, verifying tree contents.
|
||||||
|
@ -7940,6 +7938,9 @@ TEST_CASE("/redwood/correctness/unit/deltaTree/IntIntPair") {
|
||||||
// Update items vector
|
// Update items vector
|
||||||
items = std::vector<IntIntPair>(uniqueItems.begin(), uniqueItems.end());
|
items = std::vector<IntIntPair>(uniqueItems.begin(), uniqueItems.end());
|
||||||
|
|
||||||
|
printItems();
|
||||||
|
printTrees();
|
||||||
|
|
||||||
// Verify tree contents
|
// Verify tree contents
|
||||||
scanAndVerify();
|
scanAndVerify();
|
||||||
scanAndVerify2();
|
scanAndVerify2();
|
||||||
|
@ -7965,6 +7966,9 @@ TEST_CASE("/redwood/correctness/unit/deltaTree/IntIntPair") {
|
||||||
// Update items vector
|
// Update items vector
|
||||||
items = std::vector<IntIntPair>(uniqueItems.begin(), uniqueItems.end());
|
items = std::vector<IntIntPair>(uniqueItems.begin(), uniqueItems.end());
|
||||||
|
|
||||||
|
printItems();
|
||||||
|
printTrees();
|
||||||
|
|
||||||
// Verify tree contents after deletions
|
// Verify tree contents after deletions
|
||||||
scanAndVerify();
|
scanAndVerify();
|
||||||
scanAndVerify2();
|
scanAndVerify2();
|
||||||
|
@ -7993,6 +7997,9 @@ TEST_CASE("/redwood/correctness/unit/deltaTree/IntIntPair") {
|
||||||
ASSERT(!cur2.insert(p));
|
ASSERT(!cur2.insert(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printItems();
|
||||||
|
printTrees();
|
||||||
|
|
||||||
// Tree contents should still match items vector
|
// Tree contents should still match items vector
|
||||||
scanAndVerify();
|
scanAndVerify();
|
||||||
scanAndVerify2();
|
scanAndVerify2();
|
||||||
|
|
Loading…
Reference in New Issue