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

Unit tests for AhArenaAllocator. More...

#include <gtest/gtest.h>
#include <ah-arena.H>
#include <string>
#include <type_traits>
#include <vector>
#include <cstdint>
Include dependency graph for ah_arena_test.cc:

Go to the source code of this file.

Classes

class  ExternalBufferArena
 

Functions

 TEST_F (ExternalBufferArena, InitialState)
 
 TEST_F (ExternalBufferArena, SimpleAllocation)
 
 TEST_F (ExternalBufferArena, MultipleAllocations)
 
 TEST_F (ExternalBufferArena, AllocationFailsWhenFull)
 
 TEST_F (ExternalBufferArena, ExactFitAllocation)
 
 TEST_F (ExternalBufferArena, ZeroAllocationReturnsNull)
 
 TEST_F (ExternalBufferArena, LIFODeallocation)
 
 TEST_F (ExternalBufferArena, NonLIFODeallocationIsNoop)
 
 TEST_F (ExternalBufferArena, Reset)
 
 TEST_F (ExternalBufferArena, Contains)
 
 TEST (InternalArena, DefaultSize)
 
 TEST (InternalArena, CustomSize)
 
 TEST (InternalArena, AllocationWorks)
 
 TEST (ArenaMoveSemantics, MoveConstruction)
 
 TEST (ArenaMoveSemantics, MoveAssignment)
 
 TEST (ArenaMoveSemantics, SelfMoveAssignment)
 
 TEST_F (TypedAllocationTest, AllocateAndDeallocate)
 
 TEST_F (TypedAllocationTest, MultipleObjects)
 
 TEST_F (TypedAllocationTest, ResetDoesNotCallDestructors)
 
 TEST_F (TypedAllocationTest, AllocationFailsReturnsNull)
 
 TEST (ArenaAlignment, AllocAligned)
 
 TEST (ArenaAlignment, MultipleAlignedAllocations)
 
 TEST (ArenaAlignment, TypedAllocationRespectAlignment)
 
 TEST (ArenaTypeTraits, NonCopyable)
 
 TEST (ArenaTypeTraits, Movable)
 
 TEST (ArenaTypeTraits, NoexceptMoveOperations)
 
 TEST (ArenaEdgeCases, VerySmallArena)
 
 TEST (ArenaEdgeCases, DeallocWithZeroSize)
 
 TEST (ArenaEdgeCases, DeallocWithNullPtr)
 
 TEST (ArenaEdgeCases, AllocAlignedZeroSize)
 
 TEST (ArenaEdgeCases, AllocAlignedZeroAlignment)
 
 TEST (ArenaBackwardCompat, DeprecatedMethods)
 
 TEST (ArenaBackwardCompat, DealllocAlias)
 
int main (int argc, char **argv)
 

Detailed Description

Unit tests for AhArenaAllocator.

Tests cover:

  • Basic allocation and deallocation
  • External buffer vs internal allocation
  • LIFO deallocation pattern
  • Move semantics
  • Typed object allocation
  • Alignment
  • Query methods (capacity, available, etc.)
  • Edge cases (zero allocation, full arena, etc.)

Definition in file ah_arena_test.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 555 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST() [1/19]

TEST ( ArenaAlignment  ,
AllocAligned   
)

◆ TEST() [2/19]

TEST ( ArenaAlignment  ,
MultipleAlignedAllocations   
)

Definition at line 417 of file ah_arena_test.cc.

References Aleph::AhArenaAllocator::alloc_aligned(), and Aleph::maps().

◆ TEST() [3/19]

TEST ( ArenaAlignment  ,
TypedAllocationRespectAlignment   
)

Definition at line 434 of file ah_arena_test.cc.

References Aleph::AhArenaAllocator::alloc(), and Aleph::maps().

◆ TEST() [4/19]

TEST ( ArenaBackwardCompat  ,
DealllocAlias   
)

◆ TEST() [5/19]

TEST ( ArenaBackwardCompat  ,
DeprecatedMethods   
)

◆ TEST() [6/19]

TEST ( ArenaEdgeCases  ,
AllocAlignedZeroAlignment   
)

Definition at line 519 of file ah_arena_test.cc.

References Aleph::AhArenaAllocator::alloc_aligned(), and Aleph::maps().

◆ TEST() [7/19]

TEST ( ArenaEdgeCases  ,
AllocAlignedZeroSize   
)

Definition at line 511 of file ah_arena_test.cc.

References Aleph::AhArenaAllocator::alloc_aligned(), and Aleph::maps().

◆ TEST() [8/19]

TEST ( ArenaEdgeCases  ,
DeallocWithNullPtr   
)

◆ TEST() [9/19]

TEST ( ArenaEdgeCases  ,
DeallocWithZeroSize   
)

◆ TEST() [10/19]

TEST ( ArenaEdgeCases  ,
VerySmallArena   
)

◆ TEST() [11/19]

TEST ( ArenaMoveSemantics  ,
MoveAssignment   
)

Definition at line 264 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST() [12/19]

TEST ( ArenaMoveSemantics  ,
MoveConstruction   
)

Definition at line 243 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST() [13/19]

TEST ( ArenaMoveSemantics  ,
SelfMoveAssignment   
)

◆ TEST() [14/19]

TEST ( ArenaTypeTraits  ,
Movable   
)

Definition at line 462 of file ah_arena_test.cc.

◆ TEST() [15/19]

TEST ( ArenaTypeTraits  ,
NoexceptMoveOperations   
)

Definition at line 468 of file ah_arena_test.cc.

◆ TEST() [16/19]

TEST ( ArenaTypeTraits  ,
NonCopyable   
)

Definition at line 456 of file ah_arena_test.cc.

◆ TEST() [17/19]

TEST ( InternalArena  ,
AllocationWorks   
)

◆ TEST() [18/19]

TEST ( InternalArena  ,
CustomSize   
)

◆ TEST() [19/19]

◆ TEST_F() [1/14]

TEST_F ( ExternalBufferArena  ,
AllocationFailsWhenFull   
)

Definition at line 110 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [2/14]

TEST_F ( ExternalBufferArena  ,
Contains   
)

Definition at line 191 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [3/14]

TEST_F ( ExternalBufferArena  ,
ExactFitAllocation   
)

Definition at line 123 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [4/14]

TEST_F ( ExternalBufferArena  ,
InitialState   
)

Definition at line 71 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [5/14]

TEST_F ( ExternalBufferArena  ,
LIFODeallocation   
)

Definition at line 143 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [6/14]

TEST_F ( ExternalBufferArena  ,
MultipleAllocations   
)

Definition at line 93 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [7/14]

TEST_F ( ExternalBufferArena  ,
NonLIFODeallocationIsNoop   
)

Definition at line 159 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [8/14]

TEST_F ( ExternalBufferArena  ,
Reset   
)

Definition at line 171 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [9/14]

TEST_F ( ExternalBufferArena  ,
SimpleAllocation   
)

Definition at line 82 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [10/14]

TEST_F ( ExternalBufferArena  ,
ZeroAllocationReturnsNull   
)

Definition at line 136 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [11/14]

TEST_F ( TypedAllocationTest  ,
AllocateAndDeallocate   
)

Definition at line 337 of file ah_arena_test.cc.

References Aleph::deallocate(), and Aleph::maps().

◆ TEST_F() [12/14]

TEST_F ( TypedAllocationTest  ,
AllocationFailsReturnsNull   
)

Definition at line 388 of file ah_arena_test.cc.

References Aleph::maps().

◆ TEST_F() [13/14]

TEST_F ( TypedAllocationTest  ,
MultipleObjects   
)

◆ TEST_F() [14/14]

TEST_F ( TypedAllocationTest  ,
ResetDoesNotCallDestructors   
)