mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Clean TreeNode tests
This commit is contained in:
@@ -23,7 +23,7 @@ public:
|
||||
int data() { return m_data; }
|
||||
void setData(int data) { m_data = data; }
|
||||
virtual int numberOfChildren() const override { return 0; }
|
||||
#if POINCARE_TREE_LOG
|
||||
#if POINCARE_TREE_LOG
|
||||
virtual void logNodeName(std::ostream & stream) const override {
|
||||
stream << "Blob";
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ public:
|
||||
class PairByReference : public TreeByReference {
|
||||
public:
|
||||
PairByReference(TreeByReference t1, TreeByReference t2) : TreeByReference(TreePool::sharedPool()->createTreeNode<PairNode>()) {
|
||||
replaceChildAtIndexInPlace(0, t1); // TODO: Is that the correct way to do this?
|
||||
replaceChildAtIndexInPlace(1, t2); // TODO: Is that the correct way to do this?
|
||||
replaceChildAtIndexInPlace(0, t1);
|
||||
replaceChildAtIndexInPlace(1, t2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ static void assert_pool_size(int i) {
|
||||
#endif
|
||||
}
|
||||
|
||||
QUIZ_CASE(tree_by_values_are_stored_in_pool) {
|
||||
QUIZ_CASE(tree_by_values_are_discared_after_block) {
|
||||
assert_pool_size(0);
|
||||
{
|
||||
BlobByValue b(0);
|
||||
@@ -42,6 +42,23 @@ QUIZ_CASE(tree_by_values_are_stored_in_pool) {
|
||||
assert_pool_size(0);
|
||||
}
|
||||
|
||||
void make_temp_blob() {
|
||||
BlobByValue b(5);
|
||||
}
|
||||
QUIZ_CASE(tree_by_values_are_discared_after_function_call) {
|
||||
assert_pool_size(0);
|
||||
make_temp_blob();
|
||||
assert_pool_size(0);
|
||||
}
|
||||
|
||||
QUIZ_CASE(tree_by_values_can_be_copied) {
|
||||
assert_pool_size(0);
|
||||
BlobByValue b(123);
|
||||
assert_pool_size(1);
|
||||
TreeByValue t = b;
|
||||
assert_pool_size(2);
|
||||
}
|
||||
|
||||
TreeByValue blob_with_data_3() {
|
||||
return BlobByValue(3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user