Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
bplus_allocation_failure_test.cc File Reference

An insertion into a Gen_BPlus_Tree that fails for lack of memory leaves the tree as it was. More...

#include <gtest/gtest.h>
#include "allocation_failure.H"
#include <new>
#include <string>
#include <tpl_bplus_tree.H>
Include dependency graph for bplus_allocation_failure_test.cc:

Go to the source code of this file.

Classes

struct  BPlusTreeWithoutMemory
 

Functions

 TEST_F (BPlusTreeWithoutMemory, SplitOfAFullRoot)
 
 TEST_F (BPlusTreeWithoutMemory, SplitsBelowTheRoot)
 
 TEST_F (BPlusTreeWithoutMemory, KeysWhoseCopiesAllocate)
 

Detailed Description

An insertion into a Gen_BPlus_Tree that fails for lack of memory leaves the tree as it was.

Each test makes the n-th allocation of one insert() fail, for every n until the insert no longer allocates that many times, and then checks the tree. split_child() truncated the full child before allocating the new node and the separators, so a failure lost the keys of the new node, and the whole tree when insert() split a full root; and the separators that insert_nonfull() rebuilt on the way back were lost when one of their copies failed.

Definition in file bplus_allocation_failure_test.cc.

Function Documentation

◆ TEST_F() [1/3]

TEST_F ( BPlusTreeWithoutMemory  ,
KeysWhoseCopiesAllocate   
)

Definition at line 135 of file bplus_allocation_failure_test.cc.

◆ TEST_F() [2/3]

TEST_F ( BPlusTreeWithoutMemory  ,
SplitOfAFullRoot   
)

Definition at line 121 of file bplus_allocation_failure_test.cc.

◆ TEST_F() [3/3]

TEST_F ( BPlusTreeWithoutMemory  ,
SplitsBelowTheRoot   
)

Definition at line 128 of file bplus_allocation_failure_test.cc.