jaulib v1.3.0
Jau Support Library (C++, Java, ..)
test_lfringbuffer02.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
37class Integer {
38 public:
40
42
43 Integer() noexcept : value(-1) { }
44
45 Integer(const Integer &o) noexcept = default;
46 Integer(Integer &&o) noexcept = default;
47 Integer& operator=(const Integer &o) noexcept = default;
48 Integer& operator=(Integer &&o) noexcept = default;
49
50 operator Integral_type() const {
51 return value;
52 }
53 constexpr Integral_type getValue() const { return value; }
54 static Integer valueOf(const Integral_type i) { return Integer(i); }
55};
57
58template<>
60
61template<>
63
64template<>
65Integral_type getValue(const Value_type& e) { return e.getValue(); }
66
67TEST_CASE( "TestRingbuffer_A_02_a<Integral_type=jau::snsize_t, Value_type=Integer, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=false>", "[ringbuffer]" ) {
69 true /* exp_memmove */, true /* exp_memcpy */, false /* exp_secmem */>();
70}
71
72TEST_CASE( "TestRingbuffer_A_02_b<Integral_type=jau::snsize_t, Value_type=Integer, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=true>", "[ringbuffer]" ) {
74 true /* exp_memmove */, true /* exp_memcpy */, true /* exp_secmem */,
75 true /* use_memmove */, true /* use_memcpy */, true /* use_secmem */>();
76}
77
78TEST_CASE( "TestRingbuffer_A_02_c<Integral_type=jau::snsize_t, Value_type=Integer, Size_type=jau::nsize_t, exp_memmove=false, exp_memcpy=false, exp_secmem=true>", "[ringbuffer]" ) {
80 false /* exp_memmove */, false /* exp_memcpy */, true /* exp_secmem */,
81 false /* use_memmove */, false /* use_memcpy */, true /* use_secmem */>();
82}
83
Integer(const Integer &o) noexcept=default
static Integer valueOf(const Integral_type i)
Integral_type value
Integer(Integer &&o) noexcept=default
Integer(Integral_type v)
constexpr Integral_type getValue() const
Integer & operator=(Integer &&o) noexcept=default
Integer() noexcept
Integer & operator=(const Integer &o) noexcept=default
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()
Integer Value_type
Integral_type getValue(const Value_type &e)
TEST_CASE("TestRingbuffer_A_02_a<Integral_type=jau::snsize_t, Value_type=Integer, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=false>", "[ringbuffer]")
void PerformRingbufferTests()