Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
test_lfringbuffer01.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
35typedef uint8_t Integral_type;
36typedef uint8_t Value_type;
37
38template<>
39Value_type getDefault() { return (Value_type)0xff; }
40
41template<>
42Value_type createValue(const Integral_type& v) { return v; }
43
44template<>
45Integral_type getValue(const Value_type& e) { return e; }
46
47TEST_CASE( "TestRingbuffer_A_01_a<Integral_type=uint8_t, Value_type=uint8_t, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=false>", "[ringbuffer_A_01a]" ) {
49 true /* exp_memmove */, true /* exp_memcpy */, false /* exp_secmem */>();
50}
51
52TEST_CASE( "TestRingbuffer_A_01_b<Integral_type=uint8_t, Value_type=uint8_t, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=true>", "[ringbuffer_A_01b]" ) {
54 true /* exp_memmove */, true /* exp_memcpy */, true /* exp_secmem */,
55 true /* use_memmove */, true /* use_memcpy */, true /* use_secmem */>();
56}
57
58TEST_CASE( "TestRingbuffer_A_01_c<Integral_type=uint8_t, Value_type=uint8_t, Size_type=jau::nsize_t, exp_memmove=false, exp_memcpy=false, exp_secmem=true>", "[ringbuffer_A_01c]" ) {
60 false /* exp_memmove */, false /* exp_memcpy */, true /* exp_secmem */,
61 false /* use_memmove */, false /* use_memcpy */, true /* use_secmem */>();
62}
63
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
Definition: int_types.hpp:53
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
Definition: backtrace.hpp:32
Value_type createValue(const Integral_type &v)
Value_type getDefault()
uint8_t Value_type
Integral_type getValue(const Value_type &e)
uint8_t Integral_type
TEST_CASE("TestRingbuffer_A_01_a<Integral_type=uint8_t, Value_type=uint8_t, Size_type=jau::nsize_t, exp_memmove=true, exp_memcpy=true, exp_secmem=false>", "[ringbuffer_A_01a]")
void PerformRingbufferTests()