jaulib v1.3.0
Jau Support Library (C++, Java, ..)
test_lfringbuffer04.cpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2020 Gothel Software e.K.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24#include <cassert>
25#include <cinttypes>
26#include <cstring>
27#include <memory>
28
29#include <jau/ringbuffer.hpp>
30
32
33using namespace jau;
34
36
37typedef std::array<Integral_type, 6> Value_type;
38
39template<>
40Value_type getDefault() { return Value_type{-1, -1, -1, -1, -1, -1}; }
41
42template<>
43Value_type createValue(const Integral_type& v) { return Value_type{v, v+1, v+2, v+3, v+4, v+5}; }
44
45template<>
46Integral_type getValue(const Value_type& e) { return e[0]; }
47
48TEST_CASE( "TestRingbuffer_A_04_a<Integral_type=jau::snsize_t, Value_type=array<jau::snsize_t, 6>, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=false>", "[ringbuffer]" ) {
50 true /* exp_memmove */, true /* exp_memcpy */, false /* exp_secmem */>();
51}
52
53TEST_CASE( "TestRingbuffer_A_04_b<Integral_type=jau::snsize_t, Value_type=array<jau::snsize_t, 6>, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=true>", "[ringbuffer]" ) {
55 true /* exp_memmove */, true /* exp_memcpy */, true /* exp_secmem */,
56 true /* use_memmove */, true /* use_memcpy */, true /* use_secmem */>();
57}
58
59TEST_CASE( "TestRingbuffer_A_04_c<Integral_type=jau::snsize_t, Value_type=array<jau::snsize_t, 6>, Size_type=jau::nsize_t, exp_memmove=false, exp_memcpy=false, exp_secmem=true>", "[ringbuffer]" ) {
61 false /* exp_memmove */, false /* exp_memcpy */, true /* exp_secmem */,
62 false /* use_memmove */, false /* use_memcpy */, true /* use_secmem */>();
63}
64
65
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
Definition: int_types.hpp:53
int_fast32_t snsize_t
Natural 'ssize_t' alternative using int_fast32_t as its natural sized type.
Definition: int_types.hpp:65
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
Definition: backtrace.hpp:32
uint8_t Value_type
uint8_t Integral_type
jau::snsize_t Integral_type
Value_type createValue(const Integral_type &v)
Value_type getDefault()
Integral_type getValue(const Value_type &e)
TEST_CASE("TestRingbuffer_A_04_a<Integral_type=jau::snsize_t, Value_type=array<jau::snsize_t, 6>, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=false>", "[ringbuffer]")
std::array< Integral_type, 6 > Value_type
void PerformRingbufferTests()