mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Updates to chrono classes
This commit is contained in:
parent
bec9f4a2df
commit
bc158cbcbc
2
.gitignore
vendored
2
.gitignore
vendored
@ -389,3 +389,5 @@ test/vs2022/Debug MSVC C++20 - Force C++03
|
|||||||
test/vs2022/Release MSVC C++20 - No STL - Optimised -O2 - Sanitiser
|
test/vs2022/Release MSVC C++20 - No STL - Optimised -O2 - Sanitiser
|
||||||
test/test_file_list.txt
|
test/test_file_list.txt
|
||||||
test/reflog.txt
|
test/reflog.txt
|
||||||
|
test/etl_error_handler/assert_function/build-make
|
||||||
|
test/syntax_check/bgcc
|
||||||
|
|||||||
@ -49,7 +49,9 @@ SOFTWARE.
|
|||||||
#include "private/chrono/weekday_indexed.h"
|
#include "private/chrono/weekday_indexed.h"
|
||||||
#include "private/chrono/weekday_last.h"
|
#include "private/chrono/weekday_last.h"
|
||||||
#include "private/chrono/month.h"
|
#include "private/chrono/month.h"
|
||||||
#include "private/chrono/year.h"
|
#include "private/chrono/month_day.h"
|
||||||
|
#include "private/chrono/year.h"
|
||||||
|
#include "private/chrono/operators.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef ETL_IN_CHRONO_H
|
#undef ETL_IN_CHRONO_H
|
||||||
|
|||||||
@ -272,8 +272,8 @@ SOFTWARE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//*************************************
|
//*************************************
|
||||||
// Indicate if etl::literals::chrono_literals has weekdays (_day)
|
// Indicate if etl::literals::chrono_literals has days (_days)
|
||||||
#if defined(ETL_DISABLE_CHRONO_LITERALS_WEEKDAY)
|
#if defined(ETL_DISABLE_CHRONO_LITERALS_DAY)
|
||||||
#define ETL_HAS_CHRONO_LITERALS_DAY 0
|
#define ETL_HAS_CHRONO_LITERALS_DAY 0
|
||||||
#else
|
#else
|
||||||
#define ETL_HAS_CHRONO_LITERALS_DAY 1
|
#define ETL_HAS_CHRONO_LITERALS_DAY 1
|
||||||
@ -288,7 +288,7 @@ SOFTWARE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//*************************************
|
//*************************************
|
||||||
// Indicate if etl::literals::chrono_literals has month (_month)
|
// Indicate if etl::literals::chrono_literals has month (_months)
|
||||||
#if defined(ETL_DISABLE_CHRONO_LITERALS_MONTH)
|
#if defined(ETL_DISABLE_CHRONO_LITERALS_MONTH)
|
||||||
#define ETL_HAS_CHRONO_LITERALS_MONTH 0
|
#define ETL_HAS_CHRONO_LITERALS_MONTH 0
|
||||||
#else
|
#else
|
||||||
@ -296,13 +296,21 @@ SOFTWARE.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//*************************************
|
//*************************************
|
||||||
// Indicate if etl::literals::chrono_literals has year (_year)
|
// Indicate if etl::literals::chrono_literals has year (_years)
|
||||||
#if defined(ETL_DISABLE_CHRONO_LITERALS_YEAR)
|
#if defined(ETL_DISABLE_CHRONO_LITERALS_YEAR)
|
||||||
#define ETL_HAS_CHRONO_LITERALS_YEAR 0
|
#define ETL_HAS_CHRONO_LITERALS_YEAR 0
|
||||||
#else
|
#else
|
||||||
#define ETL_HAS_CHRONO_LITERALS_YEAR 1
|
#define ETL_HAS_CHRONO_LITERALS_YEAR 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//*************************************
|
||||||
|
// Indicate if etl::literals::chrono_literals has year (_hours, _minutes, _seconds, _milliseconds, _microseconds, _nanoseconds)
|
||||||
|
#if defined(ETL_DISABLE_CHRONO_LITERALS_DURATION)
|
||||||
|
#define ETL_HAS_CHRONO_LITERALS_DURATION 0
|
||||||
|
#else
|
||||||
|
#define ETL_HAS_CHRONO_LITERALS_DURATION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
//*************************************
|
//*************************************
|
||||||
// The macros below are dependent on the profile.
|
// The macros below are dependent on the profile.
|
||||||
// C++11
|
// C++11
|
||||||
|
|||||||
@ -311,7 +311,6 @@ namespace etl
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ETL_HAS_CHRONO_LITERALS_DAY
|
#if ETL_HAS_CHRONO_LITERALS_DAY
|
||||||
#if ETL_USING_CPP11
|
|
||||||
namespace etl
|
namespace etl
|
||||||
{
|
{
|
||||||
namespace literals
|
namespace literals
|
||||||
@ -321,7 +320,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for days
|
/// Literal for days
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
constexpr etl::chrono::day operator ""_day(unsigned long long d) noexcept
|
inline constexpr etl::chrono::day operator ""_day(unsigned long long d) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::day(static_cast<unsigned>(d));
|
return etl::chrono::day(static_cast<unsigned>(d));
|
||||||
}
|
}
|
||||||
@ -329,4 +328,3 @@ namespace etl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
@ -258,11 +258,17 @@ namespace etl
|
|||||||
{
|
{
|
||||||
ETL_CONSTEXPR14 size_t operator()(const etl::chrono::duration<TRep, TPeriod>& d) const
|
ETL_CONSTEXPR14 size_t operator()(const etl::chrono::duration<TRep, TPeriod>& d) const
|
||||||
{
|
{
|
||||||
TRep value = d.count();
|
uint8_t buffer[sizeof(TRep) + sizeof(intmax_t) + sizeof(intmax_t)];
|
||||||
size_t num = TPeriod::num;
|
|
||||||
size_t den = TPeriod::den;
|
|
||||||
|
|
||||||
return 0; //etl::private_hash::generic_hash<size_t>(p, p + sizeof(unsigned));
|
TRep value = d.count();
|
||||||
|
intmax_t num = TPeriod::num;
|
||||||
|
intmax_t den = TPeriod::den;
|
||||||
|
|
||||||
|
memcpy(buffer, &value, sizeof(TRep));
|
||||||
|
memcpy(buffer + sizeof(TRep), &num, sizeof(intmax_t));
|
||||||
|
memcpy(buffer + sizeof(TRep) + sizeof(intmax_t), &den, sizeof(intmax_t));
|
||||||
|
|
||||||
|
return etl::private_hash::generic_hash<size_t>(buffer, buffer + sizeof(TRep) + sizeof(intmax_t) + sizeof(intmax_t));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -349,8 +355,7 @@ namespace etl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ETL_HAS_CHRONO_LITERALS_DAY
|
#if ETL_HAS_CHRONO_LITERALS_DURATION
|
||||||
#if ETL_USING_CPP11
|
|
||||||
namespace etl
|
namespace etl
|
||||||
{
|
{
|
||||||
namespace literals
|
namespace literals
|
||||||
@ -360,7 +365,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for hours duration
|
/// Literal for hours duration
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
ETL_IF_CONSTEXPR etl::chrono::hours operator ""_hours(unsigned long long h) noexcept
|
inline ETL_CONSTEXPR etl::chrono::hours operator ""_hours(unsigned long long h) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::hours(static_cast<etl::chrono::hours::rep>(h));
|
return etl::chrono::hours(static_cast<etl::chrono::hours::rep>(h));
|
||||||
}
|
}
|
||||||
@ -368,7 +373,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for minutes duration
|
/// Literal for minutes duration
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
ETL_IF_CONSTEXPR etl::chrono::minutes operator ""_minutes(unsigned long long m) noexcept
|
inline ETL_CONSTEXPR etl::chrono::minutes operator ""_minutes(unsigned long long m) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::minutes(static_cast<etl::chrono::minutes::rep>(m));
|
return etl::chrono::minutes(static_cast<etl::chrono::minutes::rep>(m));
|
||||||
}
|
}
|
||||||
@ -376,7 +381,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for seconds duration
|
/// Literal for seconds duration
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
ETL_IF_CONSTEXPR etl::chrono::seconds operator ""_seconds(unsigned long long s) noexcept
|
inline ETL_CONSTEXPR etl::chrono::seconds operator ""_seconds(unsigned long long s) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::seconds(static_cast<etl::chrono::seconds::rep>(s));
|
return etl::chrono::seconds(static_cast<etl::chrono::seconds::rep>(s));
|
||||||
}
|
}
|
||||||
@ -384,7 +389,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for milliseconds duration
|
/// Literal for milliseconds duration
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
ETL_IF_CONSTEXPR etl::chrono::milliseconds operator ""_milliseconds(unsigned long long s) noexcept
|
inline ETL_CONSTEXPR etl::chrono::milliseconds operator ""_milliseconds(unsigned long long s) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::milliseconds(static_cast<etl::chrono::milliseconds::rep>(s));
|
return etl::chrono::milliseconds(static_cast<etl::chrono::milliseconds::rep>(s));
|
||||||
}
|
}
|
||||||
@ -392,7 +397,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for microseconds duration
|
/// Literal for microseconds duration
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
ETL_IF_CONSTEXPR etl::chrono::microseconds operator ""_microseconds(unsigned long long s) noexcept
|
inline ETL_CONSTEXPR etl::chrono::microseconds operator ""_microseconds(unsigned long long s) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::microseconds(static_cast<etl::chrono::microseconds::rep>(s));
|
return etl::chrono::microseconds(static_cast<etl::chrono::microseconds::rep>(s));
|
||||||
}
|
}
|
||||||
@ -400,7 +405,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for nanoseconds duration
|
/// Literal for nanoseconds duration
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
ETL_IF_CONSTEXPR etl::chrono::nanoseconds operator ""_nanoseconds(unsigned long long s) noexcept
|
inline ETL_CONSTEXPR etl::chrono::nanoseconds operator ""_nanoseconds(unsigned long long s) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::nanoseconds(static_cast<etl::chrono::nanoseconds::rep>(s));
|
return etl::chrono::nanoseconds(static_cast<etl::chrono::nanoseconds::rep>(s));
|
||||||
}
|
}
|
||||||
@ -408,4 +413,3 @@ namespace etl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
@ -362,7 +362,6 @@ namespace etl
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ETL_HAS_CHRONO_LITERALS_MONTH
|
#if ETL_HAS_CHRONO_LITERALS_MONTH
|
||||||
#if ETL_USING_CPP11
|
|
||||||
namespace etl
|
namespace etl
|
||||||
{
|
{
|
||||||
namespace literals
|
namespace literals
|
||||||
@ -372,7 +371,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for months
|
/// Literal for months
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
constexpr etl::chrono::month operator ""_month(unsigned long long m) noexcept
|
inline constexpr etl::chrono::month operator ""_month(unsigned long long m) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::month(static_cast<unsigned char>(m));
|
return etl::chrono::month(static_cast<unsigned char>(m));
|
||||||
}
|
}
|
||||||
@ -380,4 +379,3 @@ namespace etl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
156
include/etl/private/chrono/month_day.h
Normal file
156
include/etl/private/chrono/month_day.h
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
///\file
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
The MIT License(MIT)
|
||||||
|
|
||||||
|
Embedded Template Library.
|
||||||
|
https://github.com/ETLCPP/etl
|
||||||
|
https://www.etlcpp.com
|
||||||
|
|
||||||
|
Copyright(c) 2023 John Wellbelove
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files(the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions :
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ETL_IN_CHRONO_H
|
||||||
|
#error DO NOT DIRECTLY INCLUDE THIS FILE. USE CHRONO.H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace etl
|
||||||
|
{
|
||||||
|
namespace chrono
|
||||||
|
{
|
||||||
|
namespace private_chrono
|
||||||
|
{
|
||||||
|
static ETL_CONSTANT unsigned char days_in_month[13] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||||
|
}
|
||||||
|
|
||||||
|
class month_day
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
/// Default constructor.
|
||||||
|
//*************************************************************************
|
||||||
|
month_day() = default;
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
/// Construct from month and day.
|
||||||
|
//*************************************************************************
|
||||||
|
ETL_CONSTEXPR month_day(const etl::chrono::month& m_, const etl::chrono::day& d_) ETL_NOEXCEPT
|
||||||
|
: m(m_)
|
||||||
|
, d(d_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
/// Returns the month.
|
||||||
|
//*************************************************************************
|
||||||
|
ETL_CONSTEXPR etl::chrono::month month() const ETL_NOEXCEPT
|
||||||
|
{
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
/// Returns the day.
|
||||||
|
//*************************************************************************
|
||||||
|
ETL_CONSTEXPR etl::chrono::day day() const ETL_NOEXCEPT
|
||||||
|
{
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
/// Returns true if the month/day is valid.
|
||||||
|
//*************************************************************************
|
||||||
|
ETL_CONSTEXPR14 bool ok() const ETL_NOEXCEPT
|
||||||
|
{
|
||||||
|
if (!m.ok() || !d.ok())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned max_day = 0;
|
||||||
|
|
||||||
|
unsigned m_v = static_cast<unsigned>(m);
|
||||||
|
max_day = private_chrono::days_in_month[m_v];
|
||||||
|
|
||||||
|
return (max_day > 0) &&
|
||||||
|
(static_cast<unsigned>(d) >= 1) &&
|
||||||
|
(static_cast<unsigned>(d) <= max_day);
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
/// Returns true if the two instances are equal.
|
||||||
|
//*************************************************************************
|
||||||
|
friend ETL_CONSTEXPR bool operator ==(const etl::chrono::month_day& lhs,
|
||||||
|
const etl::chrono::month_day& rhs) ETL_NOEXCEPT
|
||||||
|
{
|
||||||
|
return (lhs.d == rhs.d) && (lhs.m == rhs.m);
|
||||||
|
}
|
||||||
|
|
||||||
|
//***********************************************************************
|
||||||
|
/// Spaceship operator
|
||||||
|
//***********************************************************************
|
||||||
|
#if ETL_USING_CPP20
|
||||||
|
friend [[nodiscard]] constexpr auto operator <=>(const etl::chrono::month_day& lhs,
|
||||||
|
const etl::chrono::month_day& rhs) noexcept
|
||||||
|
{
|
||||||
|
auto cmp = lhs.m <=> rhs.m;
|
||||||
|
|
||||||
|
if (cmp != 0)
|
||||||
|
{
|
||||||
|
return cmp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return lhs.d <=> rhs.d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
etl::chrono::month m;
|
||||||
|
etl::chrono::day d;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
/// Hash function for etl::chrono::month_day
|
||||||
|
//*************************************************************************
|
||||||
|
#if ETL_USING_8BIT_TYPES
|
||||||
|
template <>
|
||||||
|
struct hash<etl::chrono::month_day>
|
||||||
|
{
|
||||||
|
size_t operator()(const etl::chrono::month_day& md) const
|
||||||
|
{
|
||||||
|
uint8_t buffer[sizeof(unsigned int) + sizeof(unsigned int)];
|
||||||
|
|
||||||
|
unsigned int m = md.month();
|
||||||
|
unsigned int d = md.day();
|
||||||
|
|
||||||
|
memcpy(buffer, &m, sizeof(m));
|
||||||
|
memcpy(buffer + sizeof(m), &d, sizeof(d));
|
||||||
|
|
||||||
|
return etl::private_hash::generic_hash<size_t>(buffer, buffer + sizeof(unsigned int) + sizeof(unsigned int));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
189
include/etl/private/chrono/operators.h
Normal file
189
include/etl/private/chrono/operators.h
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
///\file
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
The MIT License(MIT)
|
||||||
|
|
||||||
|
Embedded Template Library.
|
||||||
|
https://github.com/ETLCPP/etl
|
||||||
|
https://www.etlcpp.com
|
||||||
|
|
||||||
|
Copyright(c) 2025 John Wellbelove
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files(the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions :
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ETL_IN_CHRONO_H
|
||||||
|
#error DO NOT DIRECTLY INCLUDE THIS FILE. USE CHRONO.H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace etl
|
||||||
|
{
|
||||||
|
namespace chrono
|
||||||
|
{
|
||||||
|
//// year_month
|
||||||
|
//constexpr auto operator/(const etl::chrono::year& y,
|
||||||
|
// const etl::chrono::month& m ) noexcept
|
||||||
|
// -> etl::chrono::year_month;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::year& y, int m ) noexcept
|
||||||
|
// -> etl::chrono::year_month;
|
||||||
|
|
||||||
|
//// month_day
|
||||||
|
//constexpr auto operator/( const etl::chrono::month& m,
|
||||||
|
// const etl::chrono::day& d ) noexcept
|
||||||
|
// -> etl::chrono::month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month& m, int d ) noexcept
|
||||||
|
// -> etl::chrono::month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int m, const etl::chrono::day& d ) noexcept
|
||||||
|
// -> etl::chrono::month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::day& d,
|
||||||
|
// const etl::chrono::month& m ) noexcept
|
||||||
|
// -> etl::chrono::month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::day& d, int m ) noexcept
|
||||||
|
// -> etl::chrono::month_day;
|
||||||
|
|
||||||
|
//// month_day_last
|
||||||
|
//constexpr auto operator/( const etl::chrono::month& m,
|
||||||
|
// etl::chrono::last_spec ) noexcept
|
||||||
|
// -> etl::chrono::month_day_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int m, etl::chrono::last_spec ) noexcept
|
||||||
|
// -> etl::chrono::month_day_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( etl::chrono::last_spec,
|
||||||
|
// const etl::chrono::month& m ) noexcept
|
||||||
|
// -> etl::chrono::month_day_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( etl::chrono::last_spec, int m ) noexcept
|
||||||
|
// -> etl::chrono::month_day_last;
|
||||||
|
|
||||||
|
//// month_weekday
|
||||||
|
//constexpr auto operator/( const etl::chrono::month& m,
|
||||||
|
// const etl::chrono::weekday_indexed& wdi ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int m, const etl::chrono::weekday_indexed& wdi ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday;
|
||||||
|
|
||||||
|
//constexpr auto operator/(const etl::chrono::weekday_indexed& wdi,
|
||||||
|
// const etl::chrono::month& m ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::weekday_indexed& wdi, int m ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday;
|
||||||
|
|
||||||
|
//// month_weekday_last
|
||||||
|
//constexpr auto operator/( const etl::chrono::month& m,
|
||||||
|
// const etl::chrono::weekday_last& wdl ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int m, const etl::chrono::weekday_last& wdl ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::weekday_last& wdl,
|
||||||
|
// const etl::chrono::month& m ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::weekday_last& wdl, int m ) noexcept
|
||||||
|
// -> etl::chrono::month_weekday_last;
|
||||||
|
|
||||||
|
//// year_month_day
|
||||||
|
//constexpr auto operator/( const etl::chrono::year_month& ym,
|
||||||
|
// const etl::chrono::day& d ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::year_month& ym, int d ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::year& y,
|
||||||
|
// const etl::chrono::month_day& md ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int y, const etl::chrono::month_day& md ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_day& md,
|
||||||
|
// const etl::chrono::year& y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_day& md, int y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day;
|
||||||
|
|
||||||
|
//// year_month_day_last
|
||||||
|
//constexpr auto operator/( const etl::chrono::year_month& ym,
|
||||||
|
// etl::chrono::last_spec ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::year& y,
|
||||||
|
// const etl::chrono::month_day_last& mdl ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int y, const etl::chrono::month_day_last& mdl ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_day_last& mdl,
|
||||||
|
// const etl::chrono::year& y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_day_last& mdl, int y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_day_last;
|
||||||
|
|
||||||
|
//// year_month_weekday
|
||||||
|
//constexpr auto operator/( const etl::chrono::year_month& ym,
|
||||||
|
// const etl::chrono::weekday_indexed& wdi ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::year& y,
|
||||||
|
// const etl::chrono::month_weekday& mwd ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int y, const etl::chrono::month_weekday& mwd ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_weekday& mwd,
|
||||||
|
// const etl::chrono::year& y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_weekday& mwd, int y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday;
|
||||||
|
|
||||||
|
//// year_month_weekday_last
|
||||||
|
//constexpr auto operator/( const etl::chrono::year_month& ym,
|
||||||
|
// const etl::chrono::weekday_last& wdl ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::year& y,
|
||||||
|
// const etl::chrono::month_weekday_last& mwdl ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( int y, const etl::chrono::month_weekday_last& mwdl ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_weekday_last& mwdl,
|
||||||
|
// const etl::chrono::year& y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday_last;
|
||||||
|
|
||||||
|
//constexpr auto operator/( const etl::chrono::month_weekday_last& mwdl, int y ) noexcept
|
||||||
|
// -> etl::chrono::year_month_weekday_last;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -370,7 +370,6 @@ namespace etl
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ETL_HAS_CHRONO_LITERALS_WEEKDAY
|
#if ETL_HAS_CHRONO_LITERALS_WEEKDAY
|
||||||
#if ETL_USING_CPP11
|
|
||||||
namespace etl
|
namespace etl
|
||||||
{
|
{
|
||||||
namespace literals
|
namespace literals
|
||||||
@ -380,12 +379,11 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for weekdays
|
/// Literal for weekdays
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
constexpr etl::chrono::weekday operator ""_weekday(unsigned long long m) noexcept
|
inline constexpr etl::chrono::weekday operator ""_weekday(unsigned long long wd) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::weekday(static_cast<unsigned char>(m));
|
return etl::chrono::weekday(static_cast<unsigned char>(wd));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
@ -311,7 +311,6 @@ namespace etl
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ETL_HAS_CHRONO_LITERALS_YEAR
|
#if ETL_HAS_CHRONO_LITERALS_YEAR
|
||||||
#if ETL_USING_CPP11
|
|
||||||
namespace etl
|
namespace etl
|
||||||
{
|
{
|
||||||
namespace literals
|
namespace literals
|
||||||
@ -321,7 +320,7 @@ namespace etl
|
|||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
/// Literal for years
|
/// Literal for years
|
||||||
//***********************************************************************
|
//***********************************************************************
|
||||||
constexpr etl::chrono::year operator ""_year(unsigned long long y) noexcept
|
inline constexpr etl::chrono::year operator ""_year(unsigned long long y) noexcept
|
||||||
{
|
{
|
||||||
return etl::chrono::year(static_cast<int16_t>(y));
|
return etl::chrono::year(static_cast<int16_t>(y));
|
||||||
}
|
}
|
||||||
@ -329,4 +328,3 @@ namespace etl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|||||||
1
test/.gitattributes
vendored
Normal file
1
test/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
@ -12,307 +12,308 @@ project(etl_unit_tests LANGUAGES CXX)
|
|||||||
|
|
||||||
add_executable(etl_tests
|
add_executable(etl_tests
|
||||||
main.cpp
|
main.cpp
|
||||||
murmurhash3.cpp
|
# murmurhash3.cpp
|
||||||
test_algorithm.cpp
|
# test_algorithm.cpp
|
||||||
test_alignment.cpp
|
# test_alignment.cpp
|
||||||
test_array.cpp
|
# test_array.cpp
|
||||||
test_array_view.cpp
|
# test_array_view.cpp
|
||||||
test_array_wrapper.cpp
|
# test_array_wrapper.cpp
|
||||||
test_atomic.cpp
|
# test_atomic.cpp
|
||||||
test_base64_RFC2152_decoder.cpp
|
# test_base64_RFC2152_decoder.cpp
|
||||||
test_base64_RFC2152_encoder.cpp
|
# test_base64_RFC2152_encoder.cpp
|
||||||
test_base64_RFC3501_decoder.cpp
|
# test_base64_RFC3501_decoder.cpp
|
||||||
test_base64_RFC3501_encoder.cpp
|
# test_base64_RFC3501_encoder.cpp
|
||||||
test_base64_RFC4648_decoder_with_no_padding.cpp
|
# test_base64_RFC4648_decoder_with_no_padding.cpp
|
||||||
test_base64_RFC4648_decoder_with_padding.cpp
|
# test_base64_RFC4648_decoder_with_padding.cpp
|
||||||
test_base64_RFC4648_encoder_with_no_padding.cpp
|
# test_base64_RFC4648_encoder_with_no_padding.cpp
|
||||||
test_base64_RFC4648_encoder_with_padding.cpp
|
# test_base64_RFC4648_encoder_with_padding.cpp
|
||||||
test_base64_RFC4648_URL_decoder_with_no_padding.cpp
|
# test_base64_RFC4648_URL_decoder_with_no_padding.cpp
|
||||||
test_base64_RFC4648_URL_decoder_with_padding.cpp
|
# test_base64_RFC4648_URL_decoder_with_padding.cpp
|
||||||
test_base64_RFC4648_URL_encoder_with_no_padding.cpp
|
# test_base64_RFC4648_URL_encoder_with_no_padding.cpp
|
||||||
test_base64_RFC4648_URL_encoder_with_padding.cpp
|
# test_base64_RFC4648_URL_encoder_with_padding.cpp
|
||||||
test_binary.cpp
|
# test_binary.cpp
|
||||||
test_bip_buffer_spsc_atomic.cpp
|
# test_bip_buffer_spsc_atomic.cpp
|
||||||
test_bit.cpp
|
# test_bit.cpp
|
||||||
test_bitset_legacy.cpp
|
# test_bitset_legacy.cpp
|
||||||
test_bitset_new_comparisons.cpp
|
# test_bitset_new_comparisons.cpp
|
||||||
test_bitset_new_default_element_type.cpp
|
# test_bitset_new_default_element_type.cpp
|
||||||
test_bitset_new_explicit_single_element_type.cpp
|
# test_bitset_new_explicit_single_element_type.cpp
|
||||||
test_bitset_new_ext_default_element_type.cpp
|
# test_bitset_new_ext_default_element_type.cpp
|
||||||
test_bitset_new_ext_explicit_single_element_type.cpp
|
# test_bitset_new_ext_explicit_single_element_type.cpp
|
||||||
test_bit_stream.cpp
|
# test_bit_stream.cpp
|
||||||
test_bit_stream_reader_big_endian.cpp
|
# test_bit_stream_reader_big_endian.cpp
|
||||||
test_bit_stream_reader_little_endian.cpp
|
# test_bit_stream_reader_little_endian.cpp
|
||||||
test_bit_stream_writer_big_endian.cpp
|
# test_bit_stream_writer_big_endian.cpp
|
||||||
test_bit_stream_writer_little_endian.cpp
|
# test_bit_stream_writer_little_endian.cpp
|
||||||
test_bloom_filter.cpp
|
# test_bloom_filter.cpp
|
||||||
test_bresenham_line.cpp
|
# test_bresenham_line.cpp
|
||||||
test_bsd_checksum.cpp
|
# test_bsd_checksum.cpp
|
||||||
test_buffer_descriptors.cpp
|
# test_buffer_descriptors.cpp
|
||||||
test_byte.cpp
|
# test_byte.cpp
|
||||||
test_byte_stream.cpp
|
# test_byte_stream.cpp
|
||||||
test_callback_service.cpp
|
# test_callback_service.cpp
|
||||||
test_callback_timer.cpp
|
# test_callback_timer.cpp
|
||||||
test_callback_timer_atomic.cpp
|
# test_callback_timer_atomic.cpp
|
||||||
test_callback_timer_interrupt.cpp
|
# test_callback_timer_interrupt.cpp
|
||||||
test_callback_timer_locked.cpp
|
# test_callback_timer_locked.cpp
|
||||||
test_char_traits.cpp
|
# test_char_traits.cpp
|
||||||
test_checksum.cpp
|
# test_checksum.cpp
|
||||||
|
|
||||||
test_chrono_day.cpp
|
test_chrono_day.cpp
|
||||||
test_chrono_weekday.cpp
|
test_chrono_duration.cpp
|
||||||
test_chrono_month.cpp
|
test_chrono_month.cpp
|
||||||
|
test_chrono_weekday.cpp
|
||||||
|
test_chrono_weekday_indexed.cpp
|
||||||
|
test_chrono_weekday_last.cpp
|
||||||
test_chrono_year.cpp
|
test_chrono_year.cpp
|
||||||
|
# test_circular_buffer.cpp
|
||||||
test_circular_buffer.cpp
|
# test_circular_buffer_external_buffer.cpp
|
||||||
test_circular_buffer_external_buffer.cpp
|
# test_circular_iterator.cpp
|
||||||
test_circular_iterator.cpp
|
# test_compare.cpp
|
||||||
test_compare.cpp
|
# test_constant.cpp
|
||||||
test_constant.cpp
|
# test_container.cpp
|
||||||
test_container.cpp
|
# test_correlation.cpp
|
||||||
test_correlation.cpp
|
# test_covariance.cpp
|
||||||
test_covariance.cpp
|
# test_crc1.cpp
|
||||||
test_crc1.cpp
|
# test_crc16.cpp
|
||||||
test_crc16.cpp
|
# test_crc16_a.cpp
|
||||||
test_crc16_a.cpp
|
# test_crc16_arc.cpp
|
||||||
test_crc16_arc.cpp
|
# test_crc16_aug_ccitt.cpp
|
||||||
test_crc16_aug_ccitt.cpp
|
# test_crc16_buypass.cpp
|
||||||
test_crc16_buypass.cpp
|
# test_crc16_ccitt.cpp
|
||||||
test_crc16_ccitt.cpp
|
# test_crc16_cdma2000.cpp
|
||||||
test_crc16_cdma2000.cpp
|
# test_crc16_dds110.cpp
|
||||||
test_crc16_dds110.cpp
|
# test_crc16_dectr.cpp
|
||||||
test_crc16_dectr.cpp
|
# test_crc16_dectx.cpp
|
||||||
test_crc16_dectx.cpp
|
# test_crc16_dnp.cpp
|
||||||
test_crc16_dnp.cpp
|
# test_crc16_en13757.cpp
|
||||||
test_crc16_en13757.cpp
|
# test_crc16_genibus.cpp
|
||||||
test_crc16_genibus.cpp
|
# test_crc16_kermit.cpp
|
||||||
test_crc16_kermit.cpp
|
# test_crc16_m17.cpp
|
||||||
test_crc16_m17.cpp
|
# test_crc16_maxim.cpp
|
||||||
test_crc16_maxim.cpp
|
# test_crc16_mcrf4xx.cpp
|
||||||
test_crc16_mcrf4xx.cpp
|
# test_crc16_modbus.cpp
|
||||||
test_crc16_modbus.cpp
|
# test_crc16_profibus.cpp
|
||||||
test_crc16_profibus.cpp
|
# test_crc16_riello.cpp
|
||||||
test_crc16_riello.cpp
|
# test_crc16_t10dif.cpp
|
||||||
test_crc16_t10dif.cpp
|
# test_crc16_teledisk.cpp
|
||||||
test_crc16_teledisk.cpp
|
# test_crc16_tms37157.cpp
|
||||||
test_crc16_tms37157.cpp
|
# test_crc16_usb.cpp
|
||||||
test_crc16_usb.cpp
|
# test_crc16_x25.cpp
|
||||||
test_crc16_x25.cpp
|
# test_crc16_xmodem.cpp
|
||||||
test_crc16_xmodem.cpp
|
# test_crc32.cpp
|
||||||
test_crc32.cpp
|
# test_crc32_bzip2.cpp
|
||||||
test_crc32_bzip2.cpp
|
# test_crc32_c.cpp
|
||||||
test_crc32_c.cpp
|
# test_crc32_d.cpp
|
||||||
test_crc32_d.cpp
|
# test_crc32_jamcrc.cpp
|
||||||
test_crc32_jamcrc.cpp
|
# test_crc32_mpeg2.cpp
|
||||||
test_crc32_mpeg2.cpp
|
# test_crc32_posix.cpp
|
||||||
test_crc32_posix.cpp
|
# test_crc32_q.cpp
|
||||||
test_crc32_q.cpp
|
# test_crc32_xfer.cpp
|
||||||
test_crc32_xfer.cpp
|
# test_crc64_ecma.cpp
|
||||||
test_crc64_ecma.cpp
|
# test_crc8_ccitt.cpp
|
||||||
test_crc8_ccitt.cpp
|
# test_crc8_cdma2000.cpp
|
||||||
test_crc8_cdma2000.cpp
|
# test_crc8_darc.cpp
|
||||||
test_crc8_darc.cpp
|
# test_crc8_dvbs2.cpp
|
||||||
test_crc8_dvbs2.cpp
|
# test_crc8_ebu.cpp
|
||||||
test_crc8_ebu.cpp
|
# test_crc8_icode.cpp
|
||||||
test_crc8_icode.cpp
|
# test_crc8_itu.cpp
|
||||||
test_crc8_itu.cpp
|
# test_crc8_j1850.cpp
|
||||||
test_crc8_j1850.cpp
|
# test_crc8_j1850_zero.cpp
|
||||||
test_crc8_j1850_zero.cpp
|
# test_crc8_maxim.cpp
|
||||||
test_crc8_maxim.cpp
|
# test_crc8_rohc.cpp
|
||||||
test_crc8_rohc.cpp
|
# test_crc8_wcdma.cpp
|
||||||
test_crc8_wcdma.cpp
|
# test_cyclic_value.cpp
|
||||||
test_cyclic_value.cpp
|
# test_debounce.cpp
|
||||||
test_debounce.cpp
|
# test_delegate.cpp
|
||||||
test_delegate.cpp
|
# test_delegate_cpp03.cpp
|
||||||
test_delegate_cpp03.cpp
|
# test_delegate_service.cpp
|
||||||
test_delegate_service.cpp
|
# test_delegate_service_compile_time.cpp
|
||||||
test_delegate_service_compile_time.cpp
|
# test_delegate_service_cpp03.cpp
|
||||||
test_delegate_service_cpp03.cpp
|
# test_deque.cpp
|
||||||
test_deque.cpp
|
# test_endian.cpp
|
||||||
test_endian.cpp
|
# test_enum_type.cpp
|
||||||
test_enum_type.cpp
|
# test_error_handler.cpp
|
||||||
test_error_handler.cpp
|
# test_etl_traits.cpp
|
||||||
test_etl_traits.cpp
|
# test_exception.cpp
|
||||||
test_exception.cpp
|
# test_expected.cpp
|
||||||
test_expected.cpp
|
# test_fixed_iterator.cpp
|
||||||
test_fixed_iterator.cpp
|
# test_fixed_sized_memory_block_allocator.cpp
|
||||||
test_fixed_sized_memory_block_allocator.cpp
|
# test_flags.cpp
|
||||||
test_flags.cpp
|
# test_flat_map.cpp
|
||||||
test_flat_map.cpp
|
# test_flat_multimap.cpp
|
||||||
test_flat_multimap.cpp
|
# test_flat_multiset.cpp
|
||||||
test_flat_multiset.cpp
|
# test_flat_set.cpp
|
||||||
test_flat_set.cpp
|
# test_fnv_1.cpp
|
||||||
test_fnv_1.cpp
|
# test_format_spec.cpp
|
||||||
test_format_spec.cpp
|
# test_forward_list.cpp
|
||||||
test_forward_list.cpp
|
# test_forward_list_shared_pool.cpp
|
||||||
test_forward_list_shared_pool.cpp
|
# test_fsm.cpp
|
||||||
test_fsm.cpp
|
# test_function.cpp
|
||||||
test_function.cpp
|
# test_functional.cpp
|
||||||
test_functional.cpp
|
# test_gamma.cpp
|
||||||
test_gamma.cpp
|
# test_hash.cpp
|
||||||
test_hash.cpp
|
# test_hfsm.cpp
|
||||||
test_hfsm.cpp
|
# test_hfsm_recurse_to_inner_state_on_start.cpp
|
||||||
test_hfsm_recurse_to_inner_state_on_start.cpp
|
# test_histogram.cpp
|
||||||
test_histogram.cpp
|
# test_indirect_vector.cpp
|
||||||
test_indirect_vector.cpp
|
# test_indirect_vector_external_buffer.cpp
|
||||||
test_indirect_vector_external_buffer.cpp
|
# test_instance_count.cpp
|
||||||
test_instance_count.cpp
|
# test_integral_limits.cpp
|
||||||
test_integral_limits.cpp
|
# test_intrusive_forward_list.cpp
|
||||||
test_intrusive_forward_list.cpp
|
# test_intrusive_links.cpp
|
||||||
test_intrusive_links.cpp
|
# test_intrusive_list.cpp
|
||||||
test_intrusive_list.cpp
|
# test_intrusive_queue.cpp
|
||||||
test_intrusive_queue.cpp
|
# test_intrusive_stack.cpp
|
||||||
test_intrusive_stack.cpp
|
# test_invert.cpp
|
||||||
test_invert.cpp
|
# test_io_port.cpp
|
||||||
test_io_port.cpp
|
# test_iterator.cpp
|
||||||
test_iterator.cpp
|
# test_jenkins.cpp
|
||||||
test_jenkins.cpp
|
# test_largest.cpp
|
||||||
test_largest.cpp
|
# test_limiter.cpp
|
||||||
test_limiter.cpp
|
# test_limits.cpp
|
||||||
test_limits.cpp
|
# test_list.cpp
|
||||||
test_list.cpp
|
# test_list_shared_pool.cpp
|
||||||
test_list_shared_pool.cpp
|
# test_macros.cpp
|
||||||
test_macros.cpp
|
# test_make_string.cpp
|
||||||
test_make_string.cpp
|
# test_map.cpp
|
||||||
test_map.cpp
|
# test_math.cpp
|
||||||
test_math.cpp
|
# test_math_functions.cpp
|
||||||
test_math_functions.cpp
|
# test_mean.cpp
|
||||||
test_mean.cpp
|
# test_memory.cpp
|
||||||
test_memory.cpp
|
# test_mem_cast.cpp
|
||||||
test_mem_cast.cpp
|
# test_mem_cast_ptr.cpp
|
||||||
test_mem_cast_ptr.cpp
|
# test_message.cpp
|
||||||
test_message.cpp
|
# test_message_broker.cpp
|
||||||
test_message_broker.cpp
|
# test_message_bus.cpp
|
||||||
test_message_bus.cpp
|
# test_message_packet.cpp
|
||||||
test_message_packet.cpp
|
# test_message_router.cpp
|
||||||
test_message_router.cpp
|
# test_message_router_registry.cpp
|
||||||
test_message_router_registry.cpp
|
# test_message_timer.cpp
|
||||||
test_message_timer.cpp
|
# test_message_timer_atomic.cpp
|
||||||
test_message_timer_atomic.cpp
|
# test_message_timer_interrupt.cpp
|
||||||
test_message_timer_interrupt.cpp
|
# test_message_timer_locked.cpp
|
||||||
test_message_timer_locked.cpp
|
# test_multimap.cpp
|
||||||
test_multimap.cpp
|
# test_multiset.cpp
|
||||||
test_multiset.cpp
|
# test_multi_array.cpp
|
||||||
test_multi_array.cpp
|
# test_multi_range.cpp
|
||||||
test_multi_range.cpp
|
# test_multi_span.cpp
|
||||||
test_multi_span.cpp
|
# test_multi_vector.cpp
|
||||||
test_multi_vector.cpp
|
# test_murmur3.cpp
|
||||||
test_murmur3.cpp
|
# test_nth_type.cpp
|
||||||
test_nth_type.cpp
|
# test_numeric.cpp
|
||||||
test_numeric.cpp
|
# test_observer.cpp
|
||||||
test_observer.cpp
|
# test_optional.cpp
|
||||||
test_optional.cpp
|
# test_overload.cpp
|
||||||
test_overload.cpp
|
# test_packet.cpp
|
||||||
test_packet.cpp
|
# test_parameter_pack.cpp
|
||||||
test_parameter_pack.cpp
|
# test_parameter_type.cpp
|
||||||
test_parameter_type.cpp
|
# test_parity_checksum.cpp
|
||||||
test_parity_checksum.cpp
|
# test_pearson.cpp
|
||||||
test_pearson.cpp
|
# test_poly_span_dynamic_extent.cpp
|
||||||
test_poly_span_dynamic_extent.cpp
|
# test_poly_span_fixed_extent.cpp
|
||||||
test_poly_span_fixed_extent.cpp
|
# test_pool.cpp
|
||||||
test_pool.cpp
|
# test_pool_external_buffer.cpp
|
||||||
test_pool_external_buffer.cpp
|
# test_priority_queue.cpp
|
||||||
test_priority_queue.cpp
|
# test_pseudo_moving_average.cpp
|
||||||
test_pseudo_moving_average.cpp
|
# test_quantize.cpp
|
||||||
test_quantize.cpp
|
# test_queue.cpp
|
||||||
test_queue.cpp
|
# test_queue_lockable.cpp
|
||||||
test_queue_lockable.cpp
|
# test_queue_lockable_small.cpp
|
||||||
test_queue_lockable_small.cpp
|
# test_queue_memory_model_small.cpp
|
||||||
test_queue_memory_model_small.cpp
|
# test_queue_mpmc_mutex.cpp
|
||||||
test_queue_mpmc_mutex.cpp
|
# test_queue_mpmc_mutex_small.cpp
|
||||||
test_queue_mpmc_mutex_small.cpp
|
# test_queue_spsc_atomic.cpp
|
||||||
test_queue_spsc_atomic.cpp
|
# test_queue_spsc_atomic_small.cpp
|
||||||
test_queue_spsc_atomic_small.cpp
|
# test_queue_spsc_isr.cpp
|
||||||
test_queue_spsc_isr.cpp
|
# test_queue_spsc_isr_small.cpp
|
||||||
test_queue_spsc_isr_small.cpp
|
# test_queue_spsc_locked.cpp
|
||||||
test_queue_spsc_locked.cpp
|
# test_queue_spsc_locked_small.cpp
|
||||||
test_queue_spsc_locked_small.cpp
|
# test_random.cpp
|
||||||
test_random.cpp
|
# test_reference_flat_map.cpp
|
||||||
test_reference_flat_map.cpp
|
# test_reference_flat_multimap.cpp
|
||||||
test_reference_flat_multimap.cpp
|
# test_reference_flat_multiset.cpp
|
||||||
test_reference_flat_multiset.cpp
|
# test_reference_flat_set.cpp
|
||||||
test_reference_flat_set.cpp
|
# test_rescale.cpp
|
||||||
test_rescale.cpp
|
# test_result.cpp
|
||||||
test_result.cpp
|
# test_rms.cpp
|
||||||
test_rms.cpp
|
# test_scaled_rounding.cpp
|
||||||
test_scaled_rounding.cpp
|
# test_set.cpp
|
||||||
test_set.cpp
|
# test_shared_message.cpp
|
||||||
test_shared_message.cpp
|
# test_singleton.cpp
|
||||||
test_singleton.cpp
|
# test_smallest.cpp
|
||||||
test_smallest.cpp
|
# test_span_dynamic_extent.cpp
|
||||||
test_span_dynamic_extent.cpp
|
# test_span_fixed_extent.cpp
|
||||||
test_span_fixed_extent.cpp
|
# test_stack.cpp
|
||||||
test_stack.cpp
|
# test_standard_deviation.cpp
|
||||||
test_standard_deviation.cpp
|
# test_state_chart.cpp
|
||||||
test_state_chart.cpp
|
# test_state_chart_compile_time.cpp
|
||||||
test_state_chart_compile_time.cpp
|
# test_state_chart_compile_time_with_data_parameter.cpp
|
||||||
test_state_chart_compile_time_with_data_parameter.cpp
|
# test_state_chart_with_data_parameter.cpp
|
||||||
test_state_chart_with_data_parameter.cpp
|
# test_state_chart_with_rvalue_data_parameter.cpp
|
||||||
test_state_chart_with_rvalue_data_parameter.cpp
|
# test_string_char.cpp
|
||||||
test_string_char.cpp
|
# test_string_char_external_buffer.cpp
|
||||||
test_string_char_external_buffer.cpp
|
# test_string_stream.cpp
|
||||||
test_string_stream.cpp
|
# test_string_stream_u16.cpp
|
||||||
test_string_stream_u16.cpp
|
# test_string_stream_u32.cpp
|
||||||
test_string_stream_u32.cpp
|
# test_string_stream_u8.cpp
|
||||||
test_string_stream_u8.cpp
|
# test_string_stream_wchar_t.cpp
|
||||||
test_string_stream_wchar_t.cpp
|
# test_string_u16.cpp
|
||||||
test_string_u16.cpp
|
# test_string_u16_external_buffer.cpp
|
||||||
test_string_u16_external_buffer.cpp
|
# test_string_u32.cpp
|
||||||
test_string_u32.cpp
|
# test_string_u32_external_buffer.cpp
|
||||||
test_string_u32_external_buffer.cpp
|
# test_string_u8.cpp
|
||||||
test_string_u8.cpp
|
# test_string_u8_external_buffer.cpp
|
||||||
test_string_u8_external_buffer.cpp
|
# test_string_utilities.cpp
|
||||||
test_string_utilities.cpp
|
# test_string_utilities_std.cpp
|
||||||
test_string_utilities_std.cpp
|
# test_string_utilities_std_u16.cpp
|
||||||
test_string_utilities_std_u16.cpp
|
# test_string_utilities_std_u32.cpp
|
||||||
test_string_utilities_std_u32.cpp
|
# test_string_utilities_std_u8.cpp
|
||||||
test_string_utilities_std_u8.cpp
|
# test_string_utilities_std_wchar_t.cpp
|
||||||
test_string_utilities_std_wchar_t.cpp
|
# test_string_utilities_u16.cpp
|
||||||
test_string_utilities_u16.cpp
|
# test_string_utilities_u32.cpp
|
||||||
test_string_utilities_u32.cpp
|
# test_string_utilities_u8.cpp
|
||||||
test_string_utilities_u8.cpp
|
# test_string_utilities_wchar_t.cpp
|
||||||
test_string_utilities_wchar_t.cpp
|
# test_string_view.cpp
|
||||||
test_string_view.cpp
|
# test_string_wchar_t.cpp
|
||||||
test_string_wchar_t.cpp
|
# test_string_wchar_t_external_buffer.cpp
|
||||||
test_string_wchar_t_external_buffer.cpp
|
# test_successor.cpp
|
||||||
test_successor.cpp
|
# test_task_scheduler.cpp
|
||||||
test_task_scheduler.cpp
|
# test_threshold.cpp
|
||||||
test_threshold.cpp
|
# test_to_arithmetic.cpp
|
||||||
test_to_arithmetic.cpp
|
# test_to_arithmetic_u16.cpp
|
||||||
test_to_arithmetic_u16.cpp
|
# test_to_arithmetic_u32.cpp
|
||||||
test_to_arithmetic_u32.cpp
|
# test_to_arithmetic_u8.cpp
|
||||||
test_to_arithmetic_u8.cpp
|
# test_to_arithmetic_wchar_t.cpp
|
||||||
test_to_arithmetic_wchar_t.cpp
|
# test_to_string.cpp
|
||||||
test_to_string.cpp
|
# test_to_u16string.cpp
|
||||||
test_to_u16string.cpp
|
# test_to_u32string.cpp
|
||||||
test_to_u32string.cpp
|
# test_to_u8string.cpp
|
||||||
test_to_u8string.cpp
|
# test_to_wstring.cpp
|
||||||
test_to_wstring.cpp
|
# test_type_def.cpp
|
||||||
test_type_def.cpp
|
# test_type_lookup.cpp
|
||||||
test_type_lookup.cpp
|
# test_type_select.cpp
|
||||||
test_type_select.cpp
|
# test_type_traits.cpp
|
||||||
test_type_traits.cpp
|
# test_unaligned_type.cpp
|
||||||
test_unaligned_type.cpp
|
# test_unaligned_type_constexpr.cpp
|
||||||
test_unaligned_type_constexpr.cpp
|
# test_unordered_map.cpp
|
||||||
test_unordered_map.cpp
|
# test_unordered_multimap.cpp
|
||||||
test_unordered_multimap.cpp
|
# test_unordered_multiset.cpp
|
||||||
test_unordered_multiset.cpp
|
# test_unordered_set.cpp
|
||||||
test_unordered_set.cpp
|
# test_user_type.cpp
|
||||||
test_user_type.cpp
|
# test_utility.cpp
|
||||||
test_utility.cpp
|
# test_variance.cpp
|
||||||
test_variance.cpp
|
# test_variant_legacy.cpp
|
||||||
test_variant_legacy.cpp
|
# test_variant_pool.cpp
|
||||||
test_variant_pool.cpp
|
# test_variant_pool_external_buffer.cpp
|
||||||
test_variant_pool_external_buffer.cpp
|
# test_variant_variadic.cpp
|
||||||
test_variant_variadic.cpp
|
# test_vector.cpp
|
||||||
test_vector.cpp
|
# test_vector_external_buffer.cpp
|
||||||
test_vector_external_buffer.cpp
|
# test_vector_non_trivial.cpp
|
||||||
test_vector_non_trivial.cpp
|
# test_vector_pointer.cpp
|
||||||
test_vector_pointer.cpp
|
# test_vector_pointer_external_buffer.cpp
|
||||||
test_vector_pointer_external_buffer.cpp
|
# test_visitor.cpp
|
||||||
test_visitor.cpp
|
# test_xor_checksum.cpp
|
||||||
test_xor_checksum.cpp
|
# test_xor_rotate_checksum.cpp
|
||||||
test_xor_rotate_checksum.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(etl_tests PRIVATE -DETL_DEBUG)
|
target_compile_definitions(etl_tests PRIVATE -DETL_DEBUG)
|
||||||
|
|||||||
5
test/cppcheck_macro_definitions.txt
Normal file
5
test/cppcheck_macro_definitions.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
ETL_CONSTEXPR constexpr
|
||||||
|
ETL_CONSTEXPR14
|
||||||
|
ETL_CONSTEXPR17
|
||||||
|
ETL_CONSTEXPR20
|
||||||
|
ETL_IF_CONSTEXPR20
|
||||||
@ -30,128 +30,112 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include "etl/platform.h"
|
#include "etl/platform.h"
|
||||||
|
|
||||||
#if ETL_USING_CPP20
|
|
||||||
|
|
||||||
#include "unit_test_framework.h"
|
#include "unit_test_framework.h"
|
||||||
|
|
||||||
#include "etl/chrono.h"
|
#include "etl/chrono.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <vector>
|
||||||
#include <array>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
//*************************************************************************
|
||||||
|
bool is_day_ok(etl::chrono::day day)
|
||||||
|
{
|
||||||
|
unsigned d = unsigned(day);
|
||||||
|
|
||||||
|
if ((d < 1) || (d > 31))
|
||||||
|
{
|
||||||
|
return (day.ok() == false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (day.ok() == true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SUITE(test_chrono_day)
|
SUITE(test_chrono_day)
|
||||||
{
|
{
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_default_constructor)
|
TEST(test_default_constructor)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day;
|
|
||||||
etl::chrono::day day;
|
etl::chrono::day day;
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
CHECK_FALSE(day.ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_constructor_in_range)
|
TEST(test_constructor_in_range)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0U; i < 256; ++i)
|
for (unsigned expected = 1U; expected < 31; ++expected)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(i);
|
etl::chrono::day day(expected);
|
||||||
etl::chrono::day day(i);
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
CHECK_TRUE(is_day_ok(day));
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_pre_increment)
|
TEST(test_pre_increment)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(0);
|
|
||||||
etl::chrono::day day(0);
|
etl::chrono::day day(0);
|
||||||
|
|
||||||
for (int i = 0; i < 255; ++i)
|
for (int expected = 0; expected < 256; ++expected, ++day)
|
||||||
{
|
{
|
||||||
++std_day;
|
CHECK_TRUE(is_day_ok(day));
|
||||||
++day;
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_post_increment)
|
TEST(test_post_increment)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(0);
|
|
||||||
etl::chrono::day day(0);
|
etl::chrono::day day(0);
|
||||||
|
|
||||||
for (int i = 0; i < 255; ++i)
|
for (int expected = 0; expected < 256; expected++, day++)
|
||||||
{
|
{
|
||||||
std::chrono::day std_last_day = std_day++;
|
CHECK_TRUE(is_day_ok(day));
|
||||||
etl::chrono::day last_day = day++;
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
|
|
||||||
CHECK_EQUAL(std_last_day.ok(), last_day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_last_day), unsigned(last_day));
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_pre_decrement)
|
TEST(test_pre_decrement)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(256);
|
etl::chrono::day day(255);
|
||||||
etl::chrono::day day(256);
|
|
||||||
|
|
||||||
for (int i = 0; i < 255; ++i)
|
for (int expected = 255; expected > 0; --expected, --day)
|
||||||
{
|
{
|
||||||
--std_day;
|
CHECK_TRUE(is_day_ok(day));
|
||||||
--day;
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_post_decrement)
|
TEST(test_post_decrement)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(256);
|
etl::chrono::day day(255);
|
||||||
etl::chrono::day day(256);
|
|
||||||
|
|
||||||
for (int i = 0; i < 255; ++i)
|
for (int expected = 255; expected > 0; expected--, day--)
|
||||||
{
|
{
|
||||||
std::chrono::day std_last_day = std_day--;
|
CHECK_TRUE(is_day_ok(day));
|
||||||
etl::chrono::day last_day = day--;
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
|
|
||||||
CHECK_EQUAL(std_last_day.ok(), last_day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_last_day), unsigned(last_day));
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_plus_equal_days)
|
TEST(test_plus_equal_days)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(0);
|
|
||||||
etl::chrono::day day(0);
|
etl::chrono::day day(0);
|
||||||
|
|
||||||
std::chrono::days std_days(2);
|
|
||||||
etl::chrono::days days(2);
|
etl::chrono::days days(2);
|
||||||
|
|
||||||
for (int i = 0; i < 128; ++i)
|
for (int expected = 2; expected < 256; expected += 2)
|
||||||
{
|
{
|
||||||
std_day += std_days;
|
day += days;
|
||||||
day += days;
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
CHECK_TRUE(is_day_ok(day));
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,17 +146,15 @@ namespace
|
|||||||
{
|
{
|
||||||
for (int ds = 0; ds < 256; ++ds)
|
for (int ds = 0; ds < 256; ++ds)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(d);
|
|
||||||
etl::chrono::day day(d);
|
etl::chrono::day day(d);
|
||||||
|
|
||||||
std::chrono::days std_days(ds);
|
|
||||||
etl::chrono::days days(ds);
|
etl::chrono::days days(ds);
|
||||||
|
|
||||||
std_day = std_day + std_days;
|
day = day + days;
|
||||||
day = day + days;
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
unsigned expected = (d + ds) % 256;
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
|
CHECK_TRUE(is_day_ok(day));
|
||||||
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,19 +164,17 @@ namespace
|
|||||||
{
|
{
|
||||||
for (int d = 0; d < 256; ++d)
|
for (int d = 0; d < 256; ++d)
|
||||||
{
|
{
|
||||||
for (int ds = 0; ds < 256; ++ds)
|
for (int ds = 0; ds < d; ++ds)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day(d);
|
|
||||||
etl::chrono::day day(d);
|
etl::chrono::day day(d);
|
||||||
|
|
||||||
std::chrono::days std_days(ds);
|
|
||||||
etl::chrono::days days(ds);
|
etl::chrono::days days(ds);
|
||||||
|
|
||||||
std_day = std_days + std_day;
|
day = days + day;
|
||||||
day = days + day;
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
unsigned expected = (d + ds) % 256;
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
|
CHECK_TRUE(is_day_ok(day));
|
||||||
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,66 +182,47 @@ namespace
|
|||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_minus_equal_days)
|
TEST(test_minus_equal_days)
|
||||||
{
|
{
|
||||||
for (int d = 0; d <= 256; ++d)
|
etl::chrono::day day(255);
|
||||||
|
etl::chrono::days days(2);
|
||||||
|
|
||||||
|
for (int expected = 253; expected > 0; expected -= 2)
|
||||||
{
|
{
|
||||||
for (int ds = 0; ds <= 256; ++ds)
|
day -= days;
|
||||||
{
|
|
||||||
std::chrono::day std_day(d);
|
|
||||||
etl::chrono::day day(d);
|
|
||||||
|
|
||||||
std::chrono::days std_days(ds);
|
CHECK_TRUE(is_day_ok(day));
|
||||||
etl::chrono::days days(ds);
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
|
|
||||||
std_day -= std_days;
|
|
||||||
day -= days;
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_day_minus_days)
|
TEST(test_day_minus_days)
|
||||||
{
|
{
|
||||||
for (int d = 0; d <= 256; ++d)
|
etl::chrono::day day(255);
|
||||||
|
etl::chrono::days days(2);
|
||||||
|
|
||||||
|
for (int expected = 253; expected > 0; expected -= 2)
|
||||||
{
|
{
|
||||||
for (int ds = 0; ds <= 256; ++ds)
|
day = day - days;
|
||||||
{
|
|
||||||
std::chrono::day std_day(d);
|
|
||||||
etl::chrono::day day(d);
|
|
||||||
|
|
||||||
std::chrono::days std_days(ds);
|
CHECK_TRUE(is_day_ok(day));
|
||||||
etl::chrono::days days(ds);
|
CHECK_EQUAL(expected, unsigned(day));
|
||||||
|
|
||||||
std_day = std_day - std_days;
|
|
||||||
day = day - days;
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_day_minus_day)
|
TEST(test_day_minus_day)
|
||||||
{
|
{
|
||||||
for (int d = 0; d < 256; ++d)
|
for (int d1 = 0; d1 < 256; ++d1)
|
||||||
{
|
{
|
||||||
std::chrono::day std_day1(d);
|
for (int d2 = 0; d2 < 256; ++d2)
|
||||||
std::chrono::day std_day2(255 - d);
|
{
|
||||||
|
etl::chrono::day day1(d1);
|
||||||
|
etl::chrono::day day2(d2);
|
||||||
|
|
||||||
std::chrono::day day1(d);
|
etl::chrono::days result_days = day1 - day2;
|
||||||
std::chrono::day day2(255 - d);
|
int expected_days = d1 - d2;
|
||||||
|
CHECK_EQUAL(expected_days, result_days.count());
|
||||||
auto std_days12 = std_day1 - std_day2;
|
}
|
||||||
auto std_days21 = std_day2 - std_day1;
|
|
||||||
|
|
||||||
auto days12 = day1 - day2;
|
|
||||||
auto days21 = day2 - day1;
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_days12.count(), days12.count());
|
|
||||||
CHECK_EQUAL(std_days21.count(), days21.count());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,14 +236,12 @@ namespace
|
|||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_literal_day)
|
TEST(test_literal_day)
|
||||||
{
|
{
|
||||||
using namespace std::literals::chrono_literals;
|
|
||||||
using namespace etl::literals::chrono_literals;
|
using namespace etl::literals::chrono_literals;
|
||||||
|
|
||||||
std::chrono::day std_day = 25d;
|
etl::chrono::day day = 25_day;
|
||||||
etl::chrono::day day = 25_day;
|
|
||||||
|
|
||||||
CHECK_EQUAL(std_day.ok(), day.ok());
|
CHECK_TRUE(day.ok());
|
||||||
CHECK_EQUAL(unsigned(std_day), unsigned(day));
|
CHECK_EQUAL(25, unsigned(day));
|
||||||
}
|
}
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
@ -329,5 +288,3 @@ namespace
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
384
test/test_chrono_month_day.cpp
Normal file
384
test/test_chrono_month_day.cpp
Normal file
@ -0,0 +1,384 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
The MIT License(MIT)
|
||||||
|
|
||||||
|
Embedded Template Library.
|
||||||
|
https://github.com/ETLCPP/etl
|
||||||
|
https://www.etlcpp.com
|
||||||
|
|
||||||
|
Documentation:
|
||||||
|
|
||||||
|
Copyright(c) 2024 John Wellbelove
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files(the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions :
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "etl/platform.h"
|
||||||
|
|
||||||
|
#include "unit_test_framework.h"
|
||||||
|
|
||||||
|
#include "etl/chrono.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <array>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#if ETL_USING_CPP20
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
SUITE(test_chrono_month_day)
|
||||||
|
{
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_default_constructor)
|
||||||
|
{
|
||||||
|
etl::chrono::month_day md;
|
||||||
|
|
||||||
|
CHECK_FALSE(md.ok());
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_constructor_in_range)
|
||||||
|
{
|
||||||
|
for (unsigned i = 0U; i < 256; ++i)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(i);
|
||||||
|
etl::chrono::month month(i);
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_pre_increment)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(0);
|
||||||
|
etl::chrono::month month(0);
|
||||||
|
|
||||||
|
for (int i = 0; i < 255; ++i)
|
||||||
|
{
|
||||||
|
++std_month;
|
||||||
|
++month;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_post_increment)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(0);
|
||||||
|
etl::chrono::month month(0);
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
std::chrono::month std_last_month = std_month++;
|
||||||
|
etl::chrono::month last_month = month++;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_last_month.ok(), last_month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_last_month), unsigned(last_month));
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_pre_decrement)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(255);
|
||||||
|
etl::chrono::month month(255);
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
--std_month;
|
||||||
|
--month;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_post_decrement)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(255);
|
||||||
|
etl::chrono::month month(255);
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
std::chrono::month std_last_month = std_month--;
|
||||||
|
etl::chrono::month last_month = month--;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_last_month.ok(), last_month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_last_month), unsigned(last_month));
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_plus_equal_months)
|
||||||
|
{
|
||||||
|
for (int m = 0; m <= 12; ++m)
|
||||||
|
{
|
||||||
|
for (int ms = 0; ms <= 24; ++ms)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(m);
|
||||||
|
etl::chrono::month month(m);
|
||||||
|
|
||||||
|
std::chrono::months std_months(ms);
|
||||||
|
etl::chrono::months months(ms);
|
||||||
|
|
||||||
|
std_month += std_months;
|
||||||
|
month += months;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_month_plus_months)
|
||||||
|
{
|
||||||
|
for (int m = 0; m <= 12; ++m)
|
||||||
|
{
|
||||||
|
for (int ms = 0; ms <= 24; ++ms)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(m);
|
||||||
|
etl::chrono::month month(m);
|
||||||
|
|
||||||
|
std::chrono::months std_months(ms);
|
||||||
|
etl::chrono::months months(ms);
|
||||||
|
|
||||||
|
std_month = std_month + std_months;
|
||||||
|
month = month + months;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_months_plus_month)
|
||||||
|
{
|
||||||
|
for (int m = 0; m <= 12; ++m)
|
||||||
|
{
|
||||||
|
for (int ms = 0; ms <= 24; ++ms)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(m);
|
||||||
|
etl::chrono::month month(m);
|
||||||
|
|
||||||
|
std::chrono::months std_months(ms);
|
||||||
|
etl::chrono::months months(ms);
|
||||||
|
|
||||||
|
std_month = std_months + std_month;
|
||||||
|
month = months + month;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_minus_equal_months)
|
||||||
|
{
|
||||||
|
for (int m = 0; m <= 12; ++m)
|
||||||
|
{
|
||||||
|
for (int ms = 0; ms <= 24; ++ms)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(m);
|
||||||
|
etl::chrono::month month(m);
|
||||||
|
|
||||||
|
std::chrono::months std_months(ms);
|
||||||
|
etl::chrono::months months(ms);
|
||||||
|
|
||||||
|
std_month -= std_months;
|
||||||
|
month -= months;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_month_minus_months)
|
||||||
|
{
|
||||||
|
for (int m = 0; m <= 12; ++m)
|
||||||
|
{
|
||||||
|
for (int ms = 0; ms <= 24; ++ms)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month(m);
|
||||||
|
etl::chrono::month month(m);
|
||||||
|
|
||||||
|
std::chrono::months std_months(ms);
|
||||||
|
etl::chrono::months months(ms);
|
||||||
|
|
||||||
|
std_month = std_month - std_months;
|
||||||
|
month = month - months;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_month.ok(), month.ok());
|
||||||
|
CHECK_EQUAL(unsigned(std_month), unsigned(month));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_month_minus_month)
|
||||||
|
{
|
||||||
|
for (int m = 0; m < 256; ++m)
|
||||||
|
{
|
||||||
|
std::chrono::month std_month1(m);
|
||||||
|
std::chrono::month std_month2(255 - m);
|
||||||
|
|
||||||
|
std::chrono::month month1(m);
|
||||||
|
std::chrono::month month2(255 - m);
|
||||||
|
|
||||||
|
auto std_months12 = std_month1 - std_month2;
|
||||||
|
auto std_months21 = std_month2 - std_month1;
|
||||||
|
|
||||||
|
auto months12 = month1 - month2;
|
||||||
|
auto months21 = month2 - month1;
|
||||||
|
|
||||||
|
CHECK_EQUAL(std_months12.count(), months12.count());
|
||||||
|
CHECK_EQUAL(std_months21.count(), months21.count());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_min_max_month)
|
||||||
|
{
|
||||||
|
CHECK_EQUAL(1U, etl::chrono::month::min());
|
||||||
|
CHECK_EQUAL(12U, etl::chrono::month::max());
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_literal_month)
|
||||||
|
{
|
||||||
|
using namespace etl::literals::chrono_literals;
|
||||||
|
|
||||||
|
etl::chrono::month month1 = 1_month;
|
||||||
|
etl::chrono::month month2 = 2_month;
|
||||||
|
etl::chrono::month month3 = 3_month;
|
||||||
|
etl::chrono::month month4 = 4_month;
|
||||||
|
etl::chrono::month month5 = 5_month;
|
||||||
|
etl::chrono::month month6 = 6_month;
|
||||||
|
etl::chrono::month month7 = 7_month;
|
||||||
|
etl::chrono::month month8 = 8_month;
|
||||||
|
etl::chrono::month month9 = 9_month;
|
||||||
|
etl::chrono::month month10 = 10_month;
|
||||||
|
etl::chrono::month month11 = 11_month;
|
||||||
|
etl::chrono::month month12 = 12_month;
|
||||||
|
|
||||||
|
CHECK_TRUE(month1.ok());
|
||||||
|
CHECK_TRUE(month2.ok());
|
||||||
|
CHECK_TRUE(month3.ok());
|
||||||
|
CHECK_TRUE(month4.ok());
|
||||||
|
CHECK_TRUE(month5.ok());
|
||||||
|
CHECK_TRUE(month6.ok());
|
||||||
|
CHECK_TRUE(month7.ok());
|
||||||
|
CHECK_TRUE(month8.ok());
|
||||||
|
CHECK_TRUE(month9.ok());
|
||||||
|
CHECK_TRUE(month10.ok());
|
||||||
|
CHECK_TRUE(month11.ok());
|
||||||
|
CHECK_TRUE(month12.ok());
|
||||||
|
|
||||||
|
CHECK_EQUAL(1U, unsigned(month1));
|
||||||
|
CHECK_EQUAL(2U, unsigned(month2));
|
||||||
|
CHECK_EQUAL(3U, unsigned(month3));
|
||||||
|
CHECK_EQUAL(4U, unsigned(month4));
|
||||||
|
CHECK_EQUAL(5U, unsigned(month5));
|
||||||
|
CHECK_EQUAL(6U, unsigned(month6));
|
||||||
|
CHECK_EQUAL(7U, unsigned(month7));
|
||||||
|
CHECK_EQUAL(8U, unsigned(month8));
|
||||||
|
CHECK_EQUAL(9U, unsigned(month9));
|
||||||
|
CHECK_EQUAL(10U, unsigned(month10));
|
||||||
|
CHECK_EQUAL(11U, unsigned(month11));
|
||||||
|
CHECK_EQUAL(12U, unsigned(month12));
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_month_comparison_operators)
|
||||||
|
{
|
||||||
|
etl::chrono::month month1(1);
|
||||||
|
etl::chrono::month month2(2);
|
||||||
|
|
||||||
|
CHECK_TRUE(month1 == month1);
|
||||||
|
CHECK_FALSE(month1 != month1);
|
||||||
|
CHECK_TRUE(month1 < month2);
|
||||||
|
CHECK_FALSE(month1 < month1);
|
||||||
|
CHECK_FALSE(month2 < month1);
|
||||||
|
CHECK_TRUE(month1 <= month2);
|
||||||
|
CHECK_TRUE(month1 <= month1);
|
||||||
|
CHECK_FALSE(month2 <= month1);
|
||||||
|
CHECK_FALSE(month1 > month2);
|
||||||
|
CHECK_FALSE(month1 > month1);
|
||||||
|
CHECK_TRUE(month2 > month1);
|
||||||
|
CHECK_FALSE(month1 >= month2);
|
||||||
|
CHECK_TRUE(month1 >= month1);
|
||||||
|
CHECK_TRUE(month2 >= month1);
|
||||||
|
|
||||||
|
#if ETL_USING_CPP20
|
||||||
|
CHECK_TRUE((month1 <=> month1) == 0);
|
||||||
|
CHECK_TRUE((month1 <=> month2) < 0);
|
||||||
|
CHECK_TRUE((month2 <=> month1) > 0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_month_hashes_are_unique)
|
||||||
|
{
|
||||||
|
std::vector<size_t> hashes;
|
||||||
|
|
||||||
|
for (int i = 0; i < 256; ++i)
|
||||||
|
{
|
||||||
|
hashes.push_back(etl::hash<etl::chrono::month>()(etl::chrono::month(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::sort(hashes.begin(), hashes.end());
|
||||||
|
(void)std::unique(hashes.begin(), hashes.end());
|
||||||
|
CHECK_EQUAL(256U, hashes.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
//*************************************************************************
|
||||||
|
TEST(test_month_types)
|
||||||
|
{
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::January), static_cast<unsigned>(etl::chrono::January));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::February), static_cast<unsigned>(etl::chrono::February));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::March), static_cast<unsigned>(etl::chrono::March));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::April), static_cast<unsigned>(etl::chrono::April));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::May), static_cast<unsigned>(etl::chrono::May));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::June), static_cast<unsigned>(etl::chrono::June));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::July), static_cast<unsigned>(etl::chrono::July));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::August), static_cast<unsigned>(etl::chrono::August));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::September), static_cast<unsigned>(etl::chrono::September));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::October), static_cast<unsigned>(etl::chrono::October));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::November), static_cast<unsigned>(etl::chrono::November));
|
||||||
|
CHECK_EQUAL(static_cast<unsigned>(std::chrono::December), static_cast<unsigned>(etl::chrono::December));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -36,6 +36,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -262,6 +263,7 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ETL_USING_CPP20
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_weekday_minus_weekday)
|
TEST(test_weekday_minus_weekday)
|
||||||
{
|
{
|
||||||
@ -283,6 +285,7 @@ namespace
|
|||||||
CHECK_EQUAL(std_days21.count(), days21.count());
|
CHECK_EQUAL(std_days21.count(), days21.count());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
TEST(test_min_max_weekday)
|
TEST(test_min_max_weekday)
|
||||||
|
|||||||
@ -36,6 +36,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|||||||
@ -3096,6 +3096,8 @@
|
|||||||
<ClInclude Include="..\..\include\etl\private\chrono\duration.h" />
|
<ClInclude Include="..\..\include\etl\private\chrono\duration.h" />
|
||||||
<ClInclude Include="..\..\include\etl\private\chrono\last_spec.h" />
|
<ClInclude Include="..\..\include\etl\private\chrono\last_spec.h" />
|
||||||
<ClInclude Include="..\..\include\etl\private\chrono\month.h" />
|
<ClInclude Include="..\..\include\etl\private\chrono\month.h" />
|
||||||
|
<ClInclude Include="..\..\include\etl\private\chrono\month_day.h" />
|
||||||
|
<ClInclude Include="..\..\include\etl\private\chrono\operators.h" />
|
||||||
<ClInclude Include="..\..\include\etl\private\chrono\weekday.h" />
|
<ClInclude Include="..\..\include\etl\private\chrono\weekday.h" />
|
||||||
<ClInclude Include="..\..\include\etl\private\chrono\weekday_indexed.h" />
|
<ClInclude Include="..\..\include\etl\private\chrono\weekday_indexed.h" />
|
||||||
<ClInclude Include="..\..\include\etl\private\chrono\weekday_last.h" />
|
<ClInclude Include="..\..\include\etl\private\chrono\weekday_last.h" />
|
||||||
@ -7959,6 +7961,7 @@
|
|||||||
<ClCompile Include="..\test_chrono_day.cpp" />
|
<ClCompile Include="..\test_chrono_day.cpp" />
|
||||||
<ClCompile Include="..\test_chrono_duration.cpp" />
|
<ClCompile Include="..\test_chrono_duration.cpp" />
|
||||||
<ClCompile Include="..\test_chrono_month.cpp" />
|
<ClCompile Include="..\test_chrono_month.cpp" />
|
||||||
|
<ClCompile Include="..\test_chrono_month_day.cpp" />
|
||||||
<ClCompile Include="..\test_chrono_weekday.cpp" />
|
<ClCompile Include="..\test_chrono_weekday.cpp" />
|
||||||
<ClCompile Include="..\test_chrono_weekday_indexed.cpp" />
|
<ClCompile Include="..\test_chrono_weekday_indexed.cpp" />
|
||||||
<ClCompile Include="..\test_chrono_weekday_last.cpp" />
|
<ClCompile Include="..\test_chrono_weekday_last.cpp" />
|
||||||
@ -9084,6 +9087,7 @@
|
|||||||
<Text Include="..\..\todo.txt" />
|
<Text Include="..\..\todo.txt" />
|
||||||
<Text Include="..\..\version.txt" />
|
<Text Include="..\..\version.txt" />
|
||||||
<Text Include="..\CMakeLists.txt" />
|
<Text Include="..\CMakeLists.txt" />
|
||||||
|
<Text Include="..\cppcheck_macro_definitions.txt" />
|
||||||
<Text Include="..\etl_error_handler\exceptions\CMakeLists.txt">
|
<Text Include="..\etl_error_handler\exceptions\CMakeLists.txt">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC - Small Strings|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug MSVC - Small Strings|Win32'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@ -1449,6 +1449,12 @@
|
|||||||
<ClInclude Include="..\..\include\etl\private\diagnostic_cxx_20_compat_push.h">
|
<ClInclude Include="..\..\include\etl\private\diagnostic_cxx_20_compat_push.h">
|
||||||
<Filter>ETL\Private</Filter>
|
<Filter>ETL\Private</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\include\etl\private\chrono\month_day.h">
|
||||||
|
<Filter>ETL\Private\chrono</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\include\etl\private\chrono\operators.h">
|
||||||
|
<Filter>ETL\Private\chrono</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\test_string_char.cpp">
|
<ClCompile Include="..\test_string_char.cpp">
|
||||||
@ -3446,6 +3452,9 @@
|
|||||||
<ClCompile Include="..\test_ratio.cpp">
|
<ClCompile Include="..\test_ratio.cpp">
|
||||||
<Filter>Tests\Misc</Filter>
|
<Filter>Tests\Misc</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\test_chrono_month_day.cpp">
|
||||||
|
<Filter>Tests\Chrono</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\library.properties">
|
<None Include="..\..\library.properties">
|
||||||
@ -3648,6 +3657,9 @@
|
|||||||
<Text Include="..\syntax_check\log.txt">
|
<Text Include="..\syntax_check\log.txt">
|
||||||
<Filter>Tests\Syntax Checks\Source</Filter>
|
<Filter>Tests\Syntax Checks\Source</Filter>
|
||||||
</Text>
|
</Text>
|
||||||
|
<Text Include="..\cppcheck_macro_definitions.txt">
|
||||||
|
<Filter>Tests\Test Support</Filter>
|
||||||
|
</Text>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\..\etl.ico">
|
<Image Include="..\..\etl.ico">
|
||||||
|
|||||||
4
test/vs2022/etl_solution_suppressions.cfg
Normal file
4
test/vs2022/etl_solution_suppressions.cfg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[cppcheck]
|
||||||
|
-i*.cpp
|
||||||
|
[cppcheck_files]
|
||||||
|
[cppcheck_includes]
|
||||||
Loading…
x
Reference in New Issue
Block a user