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

Bounded_Cycle_Index when an allocation fails: building it throws std::bad_alloc whatever allocation fails, an index built apart replaces another without allocating, an assignment that fails leaves the index as it was, and neither the queries nor the moves allocate. More...

#include <gtest/gtest.h>
#include "allocation_failure.H"
#include <new>
#include <utility>
#include <vector>
#include <Bounded_Cycle_Index.H>
#include <tpl_graph.H>
Include dependency graph for bounded_cycle_index_allocation_test.cc:

Go to the source code of this file.

Classes

struct  BoundedCycleIndexAllocation
 

Functions

 TEST_F (BoundedCycleIndexAllocation, BuildingThrowsBadAllocWhateverAllocationFails)
 
 TEST_F (BoundedCycleIndexAllocation, AnIndexBuiltApartReplacesAnotherWithoutAllocating)
 
 TEST_F (BoundedCycleIndexAllocation, TheQueriesDoNotAllocate)
 
 TEST_F (BoundedCycleIndexAllocation, AnAssignmentThatFailsLeavesTheIndexAsItWas)
 
 TEST_F (BoundedCycleIndexAllocation, MovingAnIndexDoesNotAllocate)
 

Detailed Description

Bounded_Cycle_Index when an allocation fails: building it throws std::bad_alloc whatever allocation fails, an index built apart replaces another without allocating, an assignment that fails leaves the index as it was, and neither the queries nor the moves allocate.

This program replaces the global operator new, so that a test can make an allocation fail and count those that are asked for.

Definition in file bounded_cycle_index_allocation_test.cc.

Function Documentation

◆ TEST_F() [1/5]

TEST_F ( BoundedCycleIndexAllocation  ,
AnAssignmentThatFailsLeavesTheIndexAsItWas   
)

Definition at line 244 of file bounded_cycle_index_allocation_test.cc.

References h, and k.

◆ TEST_F() [2/5]

TEST_F ( BoundedCycleIndexAllocation  ,
AnIndexBuiltApartReplacesAnotherWithoutAllocating   
)

Definition at line 169 of file bounded_cycle_index_allocation_test.cc.

References Aleph::next().

◆ TEST_F() [3/5]

TEST_F ( BoundedCycleIndexAllocation  ,
BuildingThrowsBadAllocWhateverAllocationFails   
)

Definition at line 130 of file bounded_cycle_index_allocation_test.cc.

References k.

◆ TEST_F() [4/5]

TEST_F ( BoundedCycleIndexAllocation  ,
MovingAnIndexDoesNotAllocate   
)

Definition at line 290 of file bounded_cycle_index_allocation_test.cc.

References h.

◆ TEST_F() [5/5]

TEST_F ( BoundedCycleIndexAllocation  ,
TheQueriesDoNotAllocate   
)

Definition at line 209 of file bounded_cycle_index_allocation_test.cc.

References arcs, Aleph::count(), and Aleph::sum().