Wait Queue
Loading...
Searching...
No Matches
wait_queue_test.cpp File Reference

Test scenarios for wait_queue class template. More...

#include <utility>
#include <functional>
#include <vector>
#include <string>
#include <set>
#include <optional>
#include <chrono>
#include <ranges>
#include <type_traits>
#include <thread>
#include <future>
#include <mutex>
#include <stop_token>
#include "catch2/catch_test_macros.hpp"
#include "catch2/catch_template_test_macros.hpp"
#include "queue/wait_queue.hpp"
#include "nonstd/ring_span.hpp"
#include "circular_buffer.hpp"
Include dependency graph for wait_queue_test.cpp:

Typedefs

template<typename T >
using set_elem = std::pair<int, T>
 
template<typename T >
using test_set = std::set<set_elem<T> >
 
using vv_float = std::vector<std::vector<float>>
 
using vv_wq = chops::wait_queue<vv_float>
 

Functions

template<typename Q >
void non_threaded_push_test (Q &wq, const typename Q::value_type &val, int count)
 
template<typename Q >
requires std::is_arithmetic_v<typename Q::value_type>
void non_threaded_arithmetic_test (Q &wq, int count)
 
template<typename Q >
void non_threaded_test (Q &wq)
 
template<typename T , typename Q >
void read_func (std::stop_token stop_tok, Q &wq, test_set< T > &s, std::mutex &mut)
 
template<typename T , typename Q >
void write_func (std::stop_token stop_tok, Q &wq, int start, int slice, const T &val)
 
template<typename T , typename Q >
bool threaded_test (Q &wq, int num_readers, int num_writers, int slice, const T &val)
 
 TEMPLATE_TEST_CASE ("Non-threaded wait_queue test, deque", "[wait_queue] [non_threaded] [deque]", int, double, short, std::string)
 
 TEMPLATE_TEST_CASE ("Non-threaded wait_queue test, ring_span", "[wait_queue] [non_threaded] [ring_span]", int, double, short, std::string)
 
 TEMPLATE_TEST_CASE ("Non-threaded wait_queue test, circular_buffer", "[wait_queue] [non_threaded] [circular_buffer]", int, double, short, std::string)
 
 TEST_CASE ("Non-threaded wait_queue test, testing copy construction without move construction", "[wait_queue] [no_move]")
 
 TEST_CASE ("Non-threaded wait_queue test, testing move construction without copy construction", "[wait_queue] [no_copy]")
 
 TEST_CASE ("Non-threaded wait_queue test, testing complex constructor and emplacement", "[wait_queue] [complex_type] [deque]")
 
std::size_t vv_push_func (vv_wq &wq, std::size_t cnt)
 
std::size_t vv_pop_func (vv_wq &wq, std::size_t exp)
 
 TEST_CASE ("Vector of vector of float, move and copy", "[wait_queue] [float] [vector_vector_float]")
 
 TEST_CASE ("Fixed size ring_span, testing wrap around with int type", "[wait_queue] [int] [ring_span_wrap_around]")
 
 TEST_CASE ("Threaded wait queue, deque int", "[wait_queue] [threaded] [int] [deque]")
 
 TEST_CASE ("Threaded wait queue, deque string", "[wait_queue] [threaded] [string] [deque]")
 

Variables

constexpr int N = 40
 
const vv_float data1 { { 42.0f, 43.0f }, { 63.0f, 66.0f, 69.0f}, { 7.0f } }
 
const vv_float data2 { { 8.0f }, { 0.0f }, { } }
 
const vv_float data3 { }
 

Detailed Description

Test scenarios for wait_queue class template.

Author
Cliff Green

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)