jaulib v1.3.8
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
test_basictypeconv.cpp File Reference
#include <cassert>
#include <cinttypes>
#include <cstring>
#include <jau/string_util.hpp>
#include <jau/test/catch2_ext.hpp>
#include <jau/basic_types.hpp>
#include <endian.h>
Include dependency graph for test_basictypeconv.cpp:

Go to the source code of this file.

Namespaces

namespace  test_impl
 Test private impl namespace.
 

Functions

template<typename Value_type>
static bool compare_values (const Value_type a, const Value_type b)
 
template<typename Value_type>
static Value_type compose (const uint8_t lowest_value, const jau::endian_t le_or_be)
 
template<typename Value_type>
static Value_type compose (const uint8_t lowest_value, const jau::lb_endian_t le_or_be)
 
static int16_t composeI16 (const uint8_t n1, const uint8_t n2)
 
static int32_t composeI32 (const uint8_t n1, const uint8_t n2, const uint8_t n3, const uint8_t n4)
 
static int64_t composeI64 (const uint8_t n1, const uint8_t n2, const uint8_t n3, const uint8_t n4, const uint8_t n5, const uint8_t n6, const uint8_t n7, const uint8_t n8)
 
static uint16_t composeU16 (const uint8_t n1, const uint8_t n2)
 
static uint32_t composeU32 (const uint8_t n1, const uint8_t n2, const uint8_t n3, const uint8_t n4)
 
static uint64_t composeU64 (const uint8_t n1, const uint8_t n2, const uint8_t n3, const uint8_t n4, const uint8_t n5, const uint8_t n6, const uint8_t n7, const uint8_t n8)
 
constexpr bool isLittleEndian2 () noexcept
 Just demonstrating usage of our type-traits in a convenient API manner w/o requiring to add the dummy template type.
 
template<class Dummy_type>
constexpr bool test_impl::isLittleEndian2_impl (std::enable_if_t< jau::has_endian_little_v< Dummy_type >, bool >=true) noexcept
 
template<class Dummy_type>
constexpr bool test_impl::isLittleEndian2_impl (std::enable_if_t<!jau::has_endian_little_v< Dummy_type >, bool >=true) noexcept
 
template<typename Value_type>
static void print (const Value_type a)
 
template<typename Value_type>
static void test_byteorder (const Value_type v_cpu, const Value_type v_le, const Value_type v_be)
 
 TEST_CASE ("Endianess Test 00", "[endian]")
 
 TEST_CASE ("HexString from and to byte vector conversion - Test 04", "[hexstring]")
 
 TEST_CASE ("Integer Get/Put in CPU Byte Order Test 02", "[byteorder][get][put]")
 
 TEST_CASE ("Integer Get/Put in explicit Byte Order Test 03", "[byteorder][get][put]")
 
 TEST_CASE ("Integer Type Byte Order Test 01", "[byteorder][bswap]")
 
 TEST_CASE ("Integer Type Test Test 05", "[integer][type]")
 
template<typename Value_type>
static void test_value_cpu (const Value_type v1, const Value_type v2, const Value_type v3)
 
template<typename Value_type>
static void test_value_littlebig (const Value_type v_cpu, const Value_type v_le, const Value_type v_be)
 

Variables

static constexpr bool VERBOSE = false
 

Function Documentation

◆ isLittleEndian2()

bool isLittleEndian2 ( )
constexprnoexcept

Just demonstrating usage of our type-traits in a convenient API manner w/o requiring to add the dummy template type.

Examples
test_basictypeconv.cpp.

Definition at line 63 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ TEST_CASE() [1/6]

TEST_CASE ( "Endianess Test 00" ,
"" [endian] )
Examples
test_basictypeconv.cpp, test_cow_darray_perf01.cpp, test_cow_iterator_01.cpp, test_intdecstring01.cpp, test_lfringbuffer01.cpp, and test_type_traits_queries01.cpp.

Definition at line 68 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ print()

template<typename Value_type>
static void print ( const Value_type a)
static
Examples
test_basictypeconv.cpp, and test_functional.hpp.

Definition at line 95 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ compare_values()

template<typename Value_type>
static bool compare_values ( const Value_type a,
const Value_type b )
static
Examples
test_basictypeconv.cpp.

Definition at line 103 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ test_byteorder()

template<typename Value_type>
static void test_byteorder ( const Value_type v_cpu,
const Value_type v_le,
const Value_type v_be )
static
Examples
test_basictypeconv.cpp.

Definition at line 117 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ composeU16()

static uint16_t composeU16 ( const uint8_t n1,
const uint8_t n2 )
static
Examples
test_basictypeconv.cpp.

Definition at line 153 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ composeI16()

static int16_t composeI16 ( const uint8_t n1,
const uint8_t n2 )
static
Examples
test_basictypeconv.cpp.

Definition at line 160 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ composeU32()

static uint32_t composeU32 ( const uint8_t n1,
const uint8_t n2,
const uint8_t n3,
const uint8_t n4 )
static
Examples
test_basictypeconv.cpp.

Definition at line 167 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ composeI32()

static int32_t composeI32 ( const uint8_t n1,
const uint8_t n2,
const uint8_t n3,
const uint8_t n4 )
static
Examples
test_basictypeconv.cpp.

Definition at line 176 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ composeU64()

static uint64_t composeU64 ( const uint8_t n1,
const uint8_t n2,
const uint8_t n3,
const uint8_t n4,
const uint8_t n5,
const uint8_t n6,
const uint8_t n7,
const uint8_t n8 )
static
Examples
test_basictypeconv.cpp.

Definition at line 185 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ composeI64()

static int64_t composeI64 ( const uint8_t n1,
const uint8_t n2,
const uint8_t n3,
const uint8_t n4,
const uint8_t n5,
const uint8_t n6,
const uint8_t n7,
const uint8_t n8 )
static
Examples
test_basictypeconv.cpp.

Definition at line 199 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ compose() [1/2]

template<typename Value_type>
static Value_type compose ( const uint8_t lowest_value,
const jau::lb_endian_t le_or_be )
static
Examples
test_basictypeconv.cpp.

Definition at line 215 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ compose() [2/2]

template<typename Value_type>
static Value_type compose ( const uint8_t lowest_value,
const jau::endian_t le_or_be )
static

Definition at line 231 of file test_basictypeconv.cpp.

◆ TEST_CASE() [2/6]

TEST_CASE ( "Integer Type Byte Order Test 01" ,
"" [byteorder][bswap] )

Definition at line 235 of file test_basictypeconv.cpp.

◆ test_value_cpu()

template<typename Value_type>
static void test_value_cpu ( const Value_type v1,
const Value_type v2,
const Value_type v3 )
static
Examples
test_basictypeconv.cpp.

Definition at line 317 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ TEST_CASE() [3/6]

TEST_CASE ( "Integer Get/Put in CPU Byte Order Test 02" ,
"" [byteorder][get][put] )

Definition at line 330 of file test_basictypeconv.cpp.

◆ test_value_littlebig()

template<typename Value_type>
static void test_value_littlebig ( const Value_type v_cpu,
const Value_type v_le,
const Value_type v_be )
static
Examples
test_basictypeconv.cpp.

Definition at line 380 of file test_basictypeconv.cpp.

Here is the caller graph for this function:

◆ TEST_CASE() [4/6]

TEST_CASE ( "Integer Get/Put in explicit Byte Order Test 03" ,
"" [byteorder][get][put] )

Definition at line 404 of file test_basictypeconv.cpp.

◆ TEST_CASE() [5/6]

TEST_CASE ( "HexString from and to byte vector conversion - Test 04" ,
"" [hexstring] )

Definition at line 485 of file test_basictypeconv.cpp.

◆ TEST_CASE() [6/6]

TEST_CASE ( "Integer Type Test Test 05" ,
"" [integer][type] )

Definition at line 695 of file test_basictypeconv.cpp.

Variable Documentation

◆ VERBOSE

bool VERBOSE = false
inlinestaticconstexpr

Definition at line 40 of file test_basictypeconv.cpp.