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

EXHAUSTIVE and RIGOROUS tests for AhArenaAllocator. More...

#include <gtest/gtest.h>
#include <ah-arena.H>
#include <algorithm>
#include <chrono>
#include <cstdint>
#include <limits>
#include <random>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <vector>
Include dependency graph for ah_arena_exhaustive_test.cc:

Go to the source code of this file.

Functions

 TEST (ArenaStress, ThousandSmallAllocations)
 
 TEST (ArenaStress, MixedSizeAllocations)
 
 TEST (ArenaStress, ThousandTypedAllocations)
 
 TEST (ArenaFragmentation, AlternatingSmallLarge)
 
 TEST (ArenaFragmentation, WorstCasePattern)
 
 TEST (ArenaFragmentation, RepeatedResetAndReuse)
 
 TEST (ArenaExceptionSafety, ConstructorThrows)
 
 TEST (ArenaExceptionSafety, PartialAllocationRecovery)
 
 TEST (ArenaPolymorphism, VirtualDispatch)
 
 TEST (ArenaComplexObjects, StringMembers)
 
 TEST (ArenaAlignmentAdvanced, CacheLineAlignment)
 
 TEST (ArenaAlignmentAdvanced, MixedAlignments)
 
 TEST (ArenaAlignmentAdvanced, VeryLargeAlignment)
 
 TEST (ArenaBoundary, AllocationAtExactCapacity)
 
 TEST (ArenaBoundary, SingleByteAllocations)
 
 TEST (ArenaBoundary, AlignmentPaddingAtBoundary)
 
 TEST (ArenaLIFO, DeepNesting)
 
 TEST (ArenaLIFO, InterleavedTypedAllocations)
 
 TEST (ArenaPerformance, LargeScaleAllocation)
 
 TEST (ArenaPerformance, CompareWithMalloc)
 
 TEST (ArenaStatistical, RandomizedStressTest)
 
 TEST (ArenaEdgeCases, MaxSizeAllocation)
 
 TEST (ArenaEdgeCases, AlignmentNotPowerOfTwo)
 
 TEST (ArenaEdgeCases, ConstBufferUsage)
 
 TEST (ArenaEdgeCases, ZeroCapacityArena)
 
 TEST (ArenaIntegration, RealWorldUsagePattern)
 
int main (int argc, char **argv)
 

Detailed Description

EXHAUSTIVE and RIGOROUS tests for AhArenaAllocator.

This file complements ah_arena_test.cc with:

  • Stress tests (thousands of allocations)
  • Fragmentation and realistic usage patterns
  • Exception safety tests
  • Polymorphic and complex objects
  • Multiple use/reset cycles
  • Boundary conditions and corner cases
  • Memory leak verification (via test harness)
  • Performance benchmarks
  • Statistical validation of randomized tests

COMPILE: g++ -std=c++20 -O2 -I.. -o ah_arena_exhaustive_test ah_arena_exhaustive_test.cc -lgtest -lgtest_main -pthread

RUN: ./ah_arena_exhaustive_test valgrind –leak-check=full ./ah_arena_exhaustive_test # For leak detection

Definition in file ah_arena_exhaustive_test.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1019 of file ah_arena_exhaustive_test.cc.

References Aleph::maps().

◆ TEST() [1/26]

TEST ( ArenaAlignmentAdvanced  ,
CacheLineAlignment   
)

Definition at line 529 of file ah_arena_exhaustive_test.cc.

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

◆ TEST() [2/26]

TEST ( ArenaAlignmentAdvanced  ,
MixedAlignments   
)

Definition at line 550 of file ah_arena_exhaustive_test.cc.

References Aleph::maps().

◆ TEST() [3/26]

TEST ( ArenaAlignmentAdvanced  ,
VeryLargeAlignment   
)

◆ TEST() [4/26]

TEST ( ArenaBoundary  ,
AlignmentPaddingAtBoundary   
)

◆ TEST() [5/26]

◆ TEST() [6/26]

TEST ( ArenaBoundary  ,
SingleByteAllocations   
)

◆ TEST() [7/26]

TEST ( ArenaComplexObjects  ,
StringMembers   
)

◆ TEST() [8/26]

TEST ( ArenaEdgeCases  ,
AlignmentNotPowerOfTwo   
)

◆ TEST() [9/26]

TEST ( ArenaEdgeCases  ,
ConstBufferUsage   
)

◆ TEST() [10/26]

TEST ( ArenaEdgeCases  ,
MaxSizeAllocation   
)

Definition at line 900 of file ah_arena_exhaustive_test.cc.

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

◆ TEST() [11/26]

◆ TEST() [12/26]

TEST ( ArenaExceptionSafety  ,
ConstructorThrows   
)

Definition at line 384 of file ah_arena_exhaustive_test.cc.

References Aleph::maps().

◆ TEST() [13/26]

TEST ( ArenaExceptionSafety  ,
PartialAllocationRecovery   
)

◆ TEST() [14/26]

TEST ( ArenaFragmentation  ,
AlternatingSmallLarge   
)

◆ TEST() [15/26]

◆ TEST() [16/26]

TEST ( ArenaFragmentation  ,
WorstCasePattern   
)

◆ TEST() [17/26]

TEST ( ArenaIntegration  ,
RealWorldUsagePattern   
)

◆ TEST() [18/26]

◆ TEST() [19/26]

TEST ( ArenaLIFO  ,
InterleavedTypedAllocations   
)

◆ TEST() [20/26]

TEST ( ArenaPerformance  ,
CompareWithMalloc   
)

Definition at line 795 of file ah_arena_exhaustive_test.cc.

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

◆ TEST() [21/26]

TEST ( ArenaPerformance  ,
LargeScaleAllocation   
)

Definition at line 765 of file ah_arena_exhaustive_test.cc.

References Aleph::maps(), and Aleph::HTList::size().

◆ TEST() [22/26]

TEST ( ArenaPolymorphism  ,
VirtualDispatch   
)

Definition at line 446 of file ah_arena_exhaustive_test.cc.

References Aleph::maps(), and Aleph::HTList::size().

◆ TEST() [23/26]

TEST ( ArenaStatistical  ,
RandomizedStressTest   
)

◆ TEST() [24/26]

TEST ( ArenaStress  ,
MixedSizeAllocations   
)

◆ TEST() [25/26]

◆ TEST() [26/26]

TEST ( ArenaStress  ,
ThousandTypedAllocations   
)