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

Tests for Arrayqueue. More...

#include <gtest/gtest.h>
#include <memory>
#include <deque>
#include <new>
#include <random>
#include <string>
#include <type_traits>
#include <tpl_arrayQueue.H>
#include <ahFunctional.H>
Include dependency graph for arrayqueue.cc:

Go to the source code of this file.

Classes

struct  SimpleQueue
 
struct  ComplexQueue
 
struct  Failing_Slot
 Element whose default construction, that of every slot of a new buffer, can fail as an allocation does. More...
 

Functions

 TEST (ArrayQueue, empty_queue)
 
 TEST (ArrayQueue, fill_and_empty_queue)
 
 TEST_F (SimpleQueue, put_and_get_stress)
 
 TEST_F (ComplexQueue, put_and_stress_capacity)
 
 TEST (ArrayQueue, Iterator_on_empty_queue)
 
 TEST (ArrayQueue, Iterator)
 
 TEST (ArrayQueue, traverse)
 
 TEST (ArrayQueue, copy_operations)
 
static void fill_wrapped (ArrayQueue< string > &q)
 Place g/h at slots 6/7 and wrap i/j around to slots 0/1.
 
static void expect_order (const ArrayQueue< string > &q, initializer_list< const char * > expected)
 Check the logical FIFO sequence against the expected values.
 
 TEST (ArrayQueue, copy_keeps_the_items_of_a_wrapped_queue)
 
 TEST (ArrayQueue, empty_restarts_both_ends)
 
 TEST (ArrayQueue, reserve_keeps_the_order_of_a_wrapped_queue)
 
 TEST (ArrayQueue, public_accessors_and_removals_use_fifo_order)
 
 TEST (ArrayQueue, copied_full_queue_wraps_the_next_insertion)
 
 TEST (ArrayQueue, moved_from_queue_can_be_iterated_copied_and_reused)
 
 TEST (ArrayQueue, reserve_preserves_wrapped_move_only_elements)
 
 TEST (ArrayQueue, release_then_insert_reproduces_the_reported_capacity_64_case)
 
 TEST (ArrayQueue, state_transitions_match_a_fifo_reference)
 
static string long_string (const char c)
 A string too long for the small-string buffer.
 
 TEST (ArrayQueue, put_of_own_item_copies_it_before_growing)
 
 TEST (ArrayQueue, put_of_own_item_of_a_full_wrapped_queue)
 
 TEST (ArrayQueue, failed_growth_leaves_the_queue_and_the_argument_untouched)
 

Variables

constexpr size_t N = 17
 
static size_t primes []
 

Detailed Description

Tests for Arrayqueue.

Definition in file arrayqueue.cc.

Function Documentation

◆ expect_order()

static void expect_order ( const ArrayQueue< string > &  q,
initializer_list< const char * >  expected 
)
static

Check the logical FIFO sequence against the expected values.

Definition at line 499 of file arrayqueue.cc.

References Aleph::ArrayQueue< T >::front(), and Aleph::MemArray< T >::size().

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ fill_wrapped()

static void fill_wrapped ( ArrayQueue< string > &  q)
static

Place g/h at slots 6/7 and wrap i/j around to slots 0/1.

Definition at line 488 of file arrayqueue.cc.

References Aleph::ArrayQueue< T >::get(), and Aleph::ArrayQueue< T >::put().

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ long_string()

static string long_string ( const char  c)
static

A string too long for the small-string buffer.

Definition at line 735 of file arrayqueue.cc.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST_F().

◆ TEST() [1/18]

TEST ( ArrayQueue  ,
copied_full_queue_wraps_the_next_insertion   
)

Definition at line 602 of file arrayqueue.cc.

References Aleph::copy(), and Aleph::ArrayQueue< T >::put().

◆ TEST() [2/18]

TEST ( ArrayQueue  ,
copy_keeps_the_items_of_a_wrapped_queue   
)

◆ TEST() [3/18]

◆ TEST() [4/18]

◆ TEST() [5/18]

◆ TEST() [6/18]

◆ TEST() [7/18]

◆ TEST() [8/18]

◆ TEST() [9/18]

TEST ( ArrayQueue  ,
Iterator_on_empty_queue   
)

Definition at line 332 of file arrayqueue.cc.

References LocateFunctions< Container, Type >::get_it().

◆ TEST() [10/18]

◆ TEST() [11/18]

◆ TEST() [12/18]

◆ TEST() [13/18]

◆ TEST() [14/18]

◆ TEST() [15/18]

◆ TEST() [16/18]

TEST ( ArrayQueue  ,
reserve_preserves_wrapped_move_only_elements   
)

◆ TEST() [17/18]

◆ TEST() [18/18]

◆ TEST_F() [1/2]

◆ TEST_F() [2/2]

TEST_F ( SimpleQueue  ,
put_and_get_stress   
)

Definition at line 129 of file arrayqueue.cc.

Variable Documentation

◆ N

constexpr size_t N = 17
constexpr

Definition at line 54 of file arrayqueue.cc.

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ primes

size_t primes[]
static
Initial value:
= {13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
61, 67, 71, 73, 79, 83, 89, 97, 197 }

Definition at line 342 of file arrayqueue.cc.

Referenced by demo_sieve_of_eratosthenes(), demo_transformation(), example_parallel_filter(), TEST(), and TEST().