mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Log pool on failure
This commit is contained in:
@@ -102,6 +102,7 @@ void TreePool::flatLog(std::ostream & stream) {
|
||||
node->log(stream, false);
|
||||
}
|
||||
stream << "</TreePool>";
|
||||
stream << std::endl;
|
||||
}
|
||||
|
||||
void TreePool::treeLog(std::ostream & stream) {
|
||||
@@ -110,6 +111,7 @@ void TreePool::treeLog(std::ostream & stream) {
|
||||
node->log(stream, true);
|
||||
}
|
||||
stream << "</TreePool>";
|
||||
stream << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,14 +5,32 @@
|
||||
#include "blob_node.h"
|
||||
#include "pair_node.h"
|
||||
|
||||
#if POINCARE_TREE_LOG
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
using namespace Poincare;
|
||||
|
||||
static inline int pool_size() {
|
||||
return TreePool::sharedPool()->numberOfNodes();
|
||||
}
|
||||
#if POINCARE_TREE_LOG
|
||||
static inline void log_pool() {
|
||||
TreePool::sharedPool()->flatLog(std::cout);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void assert_pool_size(int i) {
|
||||
#if POINCARE_TREE_LOG
|
||||
int poolSize = pool_size();
|
||||
if (poolSize != i) {
|
||||
std::cout << "Expected pool of size " << i << " but got " << poolSize << std::endl;
|
||||
log_pool();
|
||||
assert(false);
|
||||
}
|
||||
#else
|
||||
assert(pool_size() == i);
|
||||
#endif
|
||||
}
|
||||
|
||||
QUIZ_CASE(tree_by_values_are_stored_in_pool) {
|
||||
|
||||
Reference in New Issue
Block a user