run-syntax-checks.sh without ETL_IN_UNIT_TEST

This commit is contained in:
Roland Reichwein 2026-04-05 11:34:37 +02:00
parent ed603c576e
commit df809faea0
15 changed files with 167 additions and 198 deletions

View File

@ -35,10 +35,6 @@ SOFTWARE.
#include "platform.h"
#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST)
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#if ETL_USING_CPP11
#include "hash.h"

View File

@ -36,10 +36,6 @@ SOFTWARE.
#include "type_traits.h"
#include "utility.h"
#if ETL_NOT_USING_CPP20 && !defined(ETL_IN_UNIT_TEST)
#error NOT SUPPORTED FOR BELOW C++20
#endif
#if ETL_USING_CPP20
#if ETL_USING_STL

View File

@ -33,10 +33,6 @@ SOFTWARE.
#include "platform.h"
#if ETL_NOT_USING_CPP11
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#include "algorithm.h"
#include "functional.h"
#include "nth_type.h"
@ -45,6 +41,8 @@ SOFTWARE.
#include "private/comparator_is_transparent.h"
#if ETL_USING_CPP11
///\defgroup const_map const_map
///\ingroup containers
@ -528,14 +526,14 @@ namespace etl
value_type element_list[Size];
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename... TElements>
const_map(TElements...)
-> const_map<typename etl::nth_type_t<0, TElements...>::first_type, typename etl::nth_type_t<0, TElements...>::second_type, sizeof...(TElements)>;
#endif
#endif
//*********************************************************************
/// Map type designed for constexpr.
@ -586,16 +584,16 @@ namespace etl
}
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t Size>
const_map_ext(const etl::span<TElements, Size>&) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t Size>
const_map_ext(const TElements (&)[Size]) -> const_map_ext<typename TElements::first_type, typename TElements::second_type>;
#endif
#endif
//*************************************************************************
/// Equality test.
@ -659,3 +657,4 @@ namespace etl
} // namespace etl
#endif
#endif

View File

@ -33,10 +33,6 @@ SOFTWARE.
#include "platform.h"
#if ETL_NOT_USING_CPP11
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#include "algorithm.h"
#include "functional.h"
#include "nth_type.h"
@ -45,6 +41,8 @@ SOFTWARE.
#include "private/comparator_is_transparent.h"
#if ETL_USING_CPP11
///\defgroup const_multimap const_multimap
///\ingroup containers
@ -478,14 +476,14 @@ namespace etl
value_type element_list[Size];
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename... TPairs>
const_multimap(TPairs...)
-> const_multimap<typename etl::nth_type_t<0, TPairs...>::first_type, typename etl::nth_type_t<0, TPairs...>::second_type, sizeof...(TPairs)>;
#endif
#endif
//*********************************************************************
/// Map type designed for constexpr.
@ -536,16 +534,16 @@ namespace etl
}
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t Size>
const_multimap_ext(const etl::span<TElements, Size>&) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
template <typename TElements, size_t Size>
const_multimap_ext(const TElements (&)[Size]) -> const_multimap_ext<typename TElements::first_type, typename TElements::second_type>;
#endif
#endif
//*************************************************************************
/// Equality test.
@ -626,3 +624,4 @@ namespace etl
} // namespace etl
#endif
#endif

View File

@ -33,10 +33,6 @@ SOFTWARE.
#include "platform.h"
#if ETL_NOT_USING_CPP11
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#include "algorithm.h"
#include "functional.h"
#include "nth_type.h"
@ -45,6 +41,8 @@ SOFTWARE.
#include "private/comparator_is_transparent.h"
#if ETL_USING_CPP11
///\defgroup const_multiset const_multiset
///\ingroup containers
@ -433,13 +431,13 @@ namespace etl
value_type element_list[Size];
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename... TElements>
const_multiset(TElements...) -> const_multiset<etl::nth_type_t<0, TElements...>, sizeof...(TElements)>;
#endif
#endif
//*********************************************************************
/// Multiset type designed for constexpr.
@ -488,16 +486,16 @@ namespace etl
}
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t Size>
const_multiset_ext(const etl::span<TElements, Size>&) -> const_multiset_ext<TElements>;
template <typename TElements, size_t Size>
const_multiset_ext(const TElements (&)[Size]) -> const_multiset_ext<TElements>;
#endif
#endif
//*************************************************************************
/// Equality test.
@ -572,3 +570,4 @@ namespace etl
} // namespace etl
#endif
#endif

View File

@ -33,10 +33,6 @@ SOFTWARE.
#include "platform.h"
#if ETL_NOT_USING_CPP11
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#include "algorithm.h"
#include "functional.h"
#include "nth_type.h"
@ -45,6 +41,8 @@ SOFTWARE.
#include "private/comparator_is_transparent.h"
#if ETL_USING_CPP11
///\defgroup const_set const_set
///\ingroup containers
@ -426,13 +424,13 @@ namespace etl
value_type element_list[Size];
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename... TElements>
const_set(TElements...) -> const_set<etl::nth_type_t<0, TElements...>, sizeof...(TElements)>;
#endif
#endif
//*********************************************************************
/// Map type designed for constexpr.
@ -481,16 +479,16 @@ namespace etl
}
};
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
//*************************************************************************
/// Template deduction guides.
//*************************************************************************
#if ETL_USING_CPP17
template <typename TElements, size_t Size>
const_set_ext(const etl::span<TElements, Size>&) -> const_set_ext<TElements>;
template <typename TElements, size_t Size>
const_set_ext(const TElements (&)[Size]) -> const_set_ext<TElements>;
#endif
#endif
//*************************************************************************
/// Equality test.
@ -548,3 +546,4 @@ namespace etl
} // namespace etl
#endif
#endif

View File

@ -35,6 +35,8 @@ SOFTWARE.
#include "span.h"
#include "static_assert.h"
#if ETL_USING_CPP11
///\defgroup manchester manchester
/// Manchester encoding and decoding
///\ingroup utilities
@ -51,13 +53,13 @@ namespace etl
struct is_encodable
{
static const bool value =
#if ETL_USING_8BIT_TYPES
#if ETL_USING_8BIT_TYPES
etl::is_same<TChunk, uint8_t>::value ||
#endif
#endif
etl::is_same<TChunk, uint16_t>::value
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
|| etl::is_same<TChunk, uint32_t>::value
#endif
#endif
;
};
@ -69,13 +71,13 @@ namespace etl
struct is_decodable
{
static const bool value =
#if ETL_USING_8BIT_TYPES
#if ETL_USING_8BIT_TYPES
etl::is_same<TChunk, uint16_t>::value ||
#endif
#endif
etl::is_same<TChunk, uint32_t>::value
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
|| etl::is_same<TChunk, uint64_t>::value
#endif
#endif
;
};
@ -91,13 +93,13 @@ namespace etl
ETL_STATIC_ASSERT(sizeof(T) == 0, "Manchester encoding type should be one of [uint8_t, uint16_t, uint32_t]");
};
#if ETL_USING_8BIT_TYPES
#if ETL_USING_8BIT_TYPES
template <>
struct encoded<uint8_t>
{
typedef uint16_t type;
};
#endif
#endif
template <>
struct encoded<uint16_t>
@ -105,13 +107,13 @@ namespace etl
typedef uint32_t type;
};
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
template <>
struct encoded<uint32_t>
{
typedef uint64_t type;
};
#endif
#endif
//*************************************************************************
/// Type trait to determine the decoded type for a given encoded type.
@ -125,13 +127,13 @@ namespace etl
ETL_STATIC_ASSERT(sizeof(T) == 0, "Manchester decoding type should be one of [uint16_t, uint32_t, uint64_t]");
};
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
template <>
struct decoded<uint16_t>
{
typedef uint8_t type;
};
#endif
#endif
template <>
struct decoded<uint32_t>
@ -139,24 +141,24 @@ namespace etl
typedef uint16_t type;
};
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
template <>
struct decoded<uint64_t>
{
typedef uint32_t type;
};
#endif
#endif
//*************************************************************************
/// Normal Manchester encoding type (no inversion).
//*************************************************************************
struct manchester_type_normal
{
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
static const uint64_t inversion_mask = 0x0000000000000000ULL;
#else
#else
static const uint32_t inversion_mask = 0x00000000UL;
#endif
#endif
};
//*************************************************************************
@ -164,11 +166,11 @@ namespace etl
//*************************************************************************
struct manchester_type_inverted
{
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
static const uint64_t inversion_mask = 0xFFFFFFFFFFFFFFFFULL;
#else
#else
static const uint32_t inversion_mask = 0xFFFFFFFFUL;
#endif
#endif
};
//*************************************************************************
@ -247,11 +249,11 @@ namespace etl
ETL_STATIC_ASSERT(CHAR_BIT == etl::numeric_limits<uint_least8_t>::digits,
"Manchester requires uint_least8_t to have the same number of bits as CHAR (CHAR_BITS)");
//*************************************************************************
// Encoding functions
//*************************************************************************
//*************************************************************************
// Encoding functions
//*************************************************************************
#if ETL_USING_8BIT_TYPES
#if ETL_USING_8BIT_TYPES
//*************************************************************************
/// Encode a 8-bit unsigned value and return 16-bit result.
///\param decoded The value to encode.
@ -273,7 +275,7 @@ namespace etl
^ (0xAAAAU ^ static_cast<unsigned int>(TManchesterType::inversion_mask)));
return encoded;
}
#endif
#endif
//*************************************************************************
/// Encode a 16-bit unsigned value and return the 32-bit result.
@ -297,7 +299,7 @@ namespace etl
return encoded;
}
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
//*************************************************************************
/// Encode a 32-bit unsigned value and return the 64-bit result.
///\param decoded The value to encode.
@ -320,7 +322,7 @@ namespace etl
encoded = (encoded | (encoded << 1U)) ^ (0xAAAAAAAAAAAAAAAAULL ^ TManchesterType::inversion_mask);
return encoded;
}
#endif
#endif
//*************************************************************************
/// Encode a span of data with the specified chunk size.
@ -350,11 +352,11 @@ namespace etl
}
}
//*************************************************************************
// Decoding functions
//*************************************************************************
//*************************************************************************
// Decoding functions
//*************************************************************************
#if ETL_USING_8BIT_TYPES
#if ETL_USING_8BIT_TYPES
//*************************************************************************
/// Decode a 16-bit value and return the 8-bit result.
///\param encoded The value to decode.
@ -373,7 +375,7 @@ namespace etl
encoded = static_cast<TEncoded>((static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) >> 2)) & 0x0F0FU);
return static_cast<TDecoded>(static_cast<unsigned int>(encoded) | (static_cast<unsigned int>(encoded) >> 4U));
}
#endif
#endif
//*************************************************************************
/// Decode a 32-bit value and return the 16-bit result.
@ -394,7 +396,7 @@ namespace etl
return static_cast<TDecoded>(encoded | (encoded >> 8U));
}
#if ETL_USING_64BIT_TYPES
#if ETL_USING_64BIT_TYPES
//*************************************************************************
/// Decode a 64-bit value and return the 32-bit result.
///\param encoded The value to decode.
@ -414,7 +416,7 @@ namespace etl
encoded = (encoded | (encoded >> 8)) & 0x0000FFFF0000FFFFULL;
return static_cast<TDecoded>(encoded | (encoded >> 16U));
}
#endif
#endif
//*************************************************************************
/// Decode a span of data using the specified chunk type.
@ -500,3 +502,4 @@ namespace etl
} // namespace etl
#endif
#endif

View File

@ -34,11 +34,7 @@ SOFTWARE.
#include <stdint.h>
#if ETL_CPP11_NOT_SUPPORTED
#if !defined(ETL_IN_UNIT_TEST)
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#else
#if ETL_CPP11_SUPPORTED
namespace etl
{
//***************************************************************************

View File

@ -38,11 +38,7 @@ SOFTWARE.
#include "optional.h"
#include "variant.h"
#if ETL_CPP11_NOT_SUPPORTED
#if !defined(ETL_IN_UNIT_TEST)
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#else
#if ETL_CPP11_SUPPORTED
namespace etl
{
@ -70,7 +66,6 @@ namespace etl
{
}
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Move constructor
//*******************************************
@ -78,7 +73,6 @@ namespace etl
: data(etl::move(other.data))
{
}
#endif
//*******************************************
// Construct from a value
@ -104,15 +98,13 @@ namespace etl
{
}
//*******************************************
/// Move construct from error
//*******************************************
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Move construct from error
//*******************************************
result(TError&& error)
: data(etl::move(error))
{
}
#endif
//*******************************************
/// Copy assign
@ -141,16 +133,14 @@ namespace etl
return *this;
}
//*******************************************
/// Move assign from value
//*******************************************
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Move assign from value
//*******************************************
result& operator=(TValue&& value)
{
data = etl::move(value);
return *this;
}
#endif
//*******************************************
/// Copy assign from error
@ -161,16 +151,14 @@ namespace etl
return *this;
}
//*******************************************
/// Move assign from error
//*******************************************
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Move assign from error
//*******************************************
result& operator=(TError&& error)
{
data = etl::move(error);
return *this;
}
#endif
//*******************************************
/// <b>true</b> if result contains a value
@ -223,16 +211,14 @@ namespace etl
return etl::get<TError>(data);
}
//*******************************************
/// Returns an rvalue reference to the error.
/// Undefined if the result does not contain an error.
//*******************************************
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Returns an rvalue reference to the error.
/// Undefined if the result does not contain an error.
//*******************************************
TError&& error()
{
return etl::move(etl::get<TError>(data));
}
#endif
private:
@ -280,15 +266,13 @@ namespace etl
{
}
//*******************************************
/// Move construct from error
//*******************************************
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Move construct from error
//*******************************************
result(TError&& error)
: data(etl::move(error))
{
}
#endif
//*******************************************
/// Copy assign from error
@ -299,16 +283,14 @@ namespace etl
return *this;
}
//*******************************************
/// Move assign from error
//*******************************************
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Move assign from error
//*******************************************
result& operator=(TError&& error)
{
data = etl::move(error);
return *this;
}
#endif
//*******************************************
/// <b>true</b> if result contains a value
@ -343,16 +325,14 @@ namespace etl
return data.value();
}
//*******************************************
/// Returns an rvalue reference to the error.
/// Undefined if the result does not contain an error.
//*******************************************
#if ETL_CPP11_SUPPORTED
//*******************************************
/// Returns an rvalue reference to the error.
/// Undefined if the result does not contain an error.
//*******************************************
TError&& error()
{
return etl::move(data.value());
}
#endif
private:

View File

@ -36,6 +36,8 @@ SOFTWARE.
#include "type_traits.h"
#include "utility.h"
#if ETL_USING_CPP11
namespace etl
{
namespace private_rounded_integral_division
@ -784,3 +786,4 @@ namespace etl
} // namespace etl
#endif
#endif

View File

@ -35,10 +35,6 @@ SOFTWARE.
#include "platform.h"
#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST)
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#if ETL_USING_CPP11
#include "algorithm.h"

View File

@ -31,10 +31,6 @@ SOFTWARE.
#include "platform.h"
#if ETL_NOT_USING_CPP11 && !defined(ETL_IN_UNIT_TEST)
#error NOT SUPPORTED FOR C++03 OR BELOW
#endif
#if ETL_USING_CPP11
#if ETL_USING_STL

View File

@ -31,7 +31,6 @@ SOFTWARE.
#define ETL_TARGET_DEVICE_GENERIC
#define ETL_TARGET_OS_NONE
#define ETL_IN_UNIT_TEST
#define ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK
#define ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS
#define ETL_CALLBACK_TIMER_ENABLE_INTERRUPTS

View File

@ -6,6 +6,8 @@
#include <etl/span.h>
#include <utility>
#if ETL_USING_CPP11
SUITE(test_manchester)
{
TEST(encode_uint8_t)
@ -15,9 +17,9 @@ SUITE(test_manchester)
CHECK_EQUAL(0xAAA9, (etl::manchester::encode<uint8_t>(0x01U)));
CHECK_EQUAL(0x6AAA, (etl::manchester::encode<uint8_t>(0x80U)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0xAAAA == etl::manchester::encode<uint8_t>(0x00U), "Compile time manchester encoding failed");
#endif
#endif
}
TEST(encode_uint8_t_inverted)
@ -27,9 +29,9 @@ SUITE(test_manchester)
CHECK_EQUAL(0x5556, (etl::manchester_inverted::encode<uint8_t>(0x01U)));
CHECK_EQUAL(0x9555, (etl::manchester_inverted::encode<uint8_t>(0x80U)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x5555 == etl::manchester_inverted::encode<uint8_t>(0x00U), "Compile time manchester encoding failed");
#endif
#endif
}
TEST(encode_uint16_t)
@ -37,9 +39,9 @@ SUITE(test_manchester)
CHECK_EQUAL(0x5555AAAA, (etl::manchester::encode<uint16_t>(0xFF00UL)));
CHECK_EQUAL(0x6AAAAAA9, (etl::manchester::encode<uint16_t>(0x8001UL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x5555AAAA == etl::manchester::encode<uint16_t>(0xFF00UL), "Compile time manchester encoding failed");
#endif
#endif
}
TEST(encode_uint16_t_inverted)
@ -47,30 +49,30 @@ SUITE(test_manchester)
CHECK_EQUAL(0xAAAA5555, (etl::manchester_inverted::encode<uint16_t>(0xFF00UL)));
CHECK_EQUAL(0x95555556, (etl::manchester_inverted::encode<uint16_t>(0x8001UL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0xAAAA5555 == etl::manchester_inverted::encode<uint16_t>(0xFF00UL), "Compile time manchester encoding failed");
#endif
#endif
}
TEST(encode_uint32_t)
{
CHECK_EQUAL(0x6AAAAAA95555AAAA, (etl::manchester::encode<uint32_t>(0x8001FF00ULL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x6AAAAAA95555AAAA == etl::manchester::encode<uint32_t>(0x8001FF00ULL), "Compile time manchester encoding failed");
#endif
#endif
}
TEST(encode_uint32_t_inverted)
{
CHECK_EQUAL(0x95555556AAAA5555, (etl::manchester_inverted::encode<uint32_t>(0x8001FF00ULL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x95555556AAAA5555 == etl::manchester_inverted::encode<uint32_t>(0x8001FF00ULL), "Compile time manchester encoding failed");
#endif
#endif
}
#if ETL_USING_CPP14
#if ETL_USING_CPP14
constexpr etl::array<uint8_t, 8> manchester_encoded_uint8(etl::span<const uint_least8_t> decoded)
{
etl::array<uint8_t, 8> encoded{0, 0, 0, 0, 0, 0, 0, 0};
@ -91,7 +93,7 @@ SUITE(test_manchester)
etl::manchester::encode<uint32_t>(decoded, encoded);
return encoded;
}
#endif
#endif
TEST(encode_span)
{
@ -121,7 +123,7 @@ SUITE(test_manchester)
CHECK_TRUE(encoded0 == encoded3);
}
#if ETL_USING_CPP14
#if ETL_USING_CPP14
TEST(encode_span_constexpr)
{
constexpr etl::array<const uint8_t, 4> decoded{0x00, 0xFF, 0x01, 0x80};
@ -153,7 +155,7 @@ SUITE(test_manchester)
static_assert(manchester_encoded_uint32(decoded)[6] == 0xAA, "Compile time encoding with uint32_t failed");
static_assert(manchester_encoded_uint32(decoded)[7] == 0x6A, "Compile time encoding with uint32_t failed");
}
#endif
#endif
TEST(encode_span_inverted)
{
@ -214,9 +216,9 @@ SUITE(test_manchester)
CHECK_EQUAL(0x01, (etl::manchester::decode<uint16_t>(0xAAA9UL)));
CHECK_EQUAL(0x80, (etl::manchester::decode<uint16_t>(0x6AAAUL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x00 == etl::manchester::decode<uint16_t>(0xAAAAUL), "Compile time manchester decoding failed");
#endif
#endif
}
TEST(decode_uint16_t_inverted)
@ -226,9 +228,9 @@ SUITE(test_manchester)
CHECK_EQUAL(0x01, (etl::manchester_inverted::decode<uint16_t>(0x5556UL)));
CHECK_EQUAL(0x80, (etl::manchester_inverted::decode<uint16_t>(0x9555UL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x00 == etl::manchester_inverted::decode<uint16_t>(0x5555UL), "Compile time manchester decoding failed");
#endif
#endif
}
TEST(decode_uint32_t)
@ -236,9 +238,9 @@ SUITE(test_manchester)
CHECK_EQUAL(0xFF00UL, (etl::manchester::decode<uint32_t>(0x5555AAAAUL)));
CHECK_EQUAL(0x8001UL, (etl::manchester::decode<uint32_t>(0x6AAAAAA9UL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0xFF00UL == etl::manchester::decode<uint32_t>(0x5555AAAAUL), "Compile time manchester decoding failed");
#endif
#endif
}
TEST(decode_uint32_t_inverted)
@ -246,30 +248,30 @@ SUITE(test_manchester)
CHECK_EQUAL(0xFF00UL, (etl::manchester_inverted::decode<uint32_t>(0xAAAA5555UL)));
CHECK_EQUAL(0x8001UL, (etl::manchester_inverted::decode<uint32_t>(0x95555556UL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0xFF00UL == etl::manchester_inverted::decode<uint32_t>(0xAAAA5555UL), "Compile time manchester decoding failed");
#endif
#endif
}
TEST(decode_uint64_t)
{
CHECK_EQUAL(0x8001FF00ULL, (etl::manchester::decode<uint64_t>(0x6AAAAAA95555AAAAULL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x8001FF00ULL == etl::manchester::decode<uint64_t>(0x6AAAAAA95555AAAAULL), "Compile time manchester decoding failed");
#endif
#endif
}
TEST(decode_uint64_t_inverted)
{
CHECK_EQUAL(0x8001FF00ULL, (etl::manchester_inverted::decode<uint64_t>(0x95555556AAAA5555ULL)));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(0x8001FF00ULL == etl::manchester_inverted::decode<uint64_t>(0x95555556AAAA5555ULL), "Compile time manchester decoding failed");
#endif
#endif
}
#if ETL_USING_CPP14
#if ETL_USING_CPP14
constexpr etl::array<uint8_t, 4> manchester_decoded_uint16(etl::span<const uint_least8_t> encoded)
{
etl::array<uint8_t, 4> decoded{0, 0, 0, 0};
@ -290,7 +292,7 @@ SUITE(test_manchester)
etl::manchester::decode<uint64_t>(encoded, decoded);
return decoded;
}
#endif
#endif
TEST(decode_span)
{
@ -316,7 +318,7 @@ SUITE(test_manchester)
CHECK_TRUE(decoded0 == decoded3);
}
#if ETL_USING_CPP14
#if ETL_USING_CPP14
TEST(decode_span_constexpr)
{
constexpr etl::array<const uint8_t, 8> encoded{0xAA, 0xAA, 0x55, 0x55, 0xA9, 0xAA, 0xAA, 0x6A};
@ -336,7 +338,7 @@ SUITE(test_manchester)
static_assert(manchester_decoded_uint64(encoded)[2] == 0x01, "Compile time decoding with uint64_t failed");
static_assert(manchester_decoded_uint64(encoded)[3] == 0x80, "Compile time decoding with uint64_t failed");
}
#endif
#endif
TEST(decode_span_inverted)
{
@ -395,10 +397,10 @@ SUITE(test_manchester)
CHECK_FALSE(etl::manchester::is_valid<uint16_t>(0xAAA8UL));
CHECK_FALSE(etl::manchester_inverted::is_valid<uint16_t>(0xAAA8UL));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(etl::manchester::is_valid<uint16_t>(0xAAAAUL), "Compile time manchester validity check failed");
static_assert(etl::manchester_inverted::is_valid<uint16_t>(0xAAAAUL), "Compile time manchester validity check failed");
#endif
#endif
}
TEST(valid32)
@ -408,10 +410,10 @@ SUITE(test_manchester)
CHECK_FALSE(etl::manchester::is_valid<uint32_t>(0xAAAAAAA8UL));
CHECK_FALSE(etl::manchester_inverted::is_valid<uint32_t>(0xAAAAAAA8UL));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(etl::manchester::is_valid<uint32_t>(0xAAAAAAAAUL), "Compile time manchester validity check failed");
static_assert(etl::manchester_inverted::is_valid<uint32_t>(0xAAAAAAAAUL), "Compile time manchester validity check failed");
#endif
#endif
}
TEST(valid64)
@ -421,10 +423,10 @@ SUITE(test_manchester)
CHECK_FALSE(etl::manchester::is_valid<uint64_t>(0xAAAAAAAAAAAAAAA8ULL));
CHECK_FALSE(etl::manchester_inverted::is_valid<uint64_t>(0xAAAAAAAAAAAAAAA8ULL));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(etl::manchester::is_valid<uint64_t>(0xAAAAAAAAAAAAAAAAULL), "Compile time manchester validity check failed");
static_assert(etl::manchester_inverted::is_valid<uint64_t>(0xAAAAAAAAAAAAAAAAULL), "Compile time manchester validity check failed");
#endif
#endif
}
TEST(valid_span)
@ -435,10 +437,10 @@ SUITE(test_manchester)
CHECK_TRUE(etl::manchester::is_valid(encoded1));
CHECK_FALSE(etl::manchester::is_valid(encoded2));
#if ETL_USING_CPP14
#if ETL_USING_CPP14
static_assert(etl::manchester::is_valid(encoded1), "Compile time manchester validity check failed");
static_assert(!etl::manchester::is_valid(encoded2), "Compile time manchester validity check failed");
#endif
#endif
}
TEST(valid_span_on_invalid_source)
@ -447,3 +449,5 @@ SUITE(test_manchester)
CHECK_THROW({ std::ignore = etl::manchester::is_valid(invalid_source); }, etl::manchester_invalid_size);
}
}
#endif

View File

@ -34,6 +34,8 @@ SOFTWARE.
#include <limits>
#include <stdint.h>
#if ETL_USING_CPP11
namespace
{
SUITE(test_constant)
@ -910,3 +912,5 @@ namespace
}
}
} // namespace
#endif