mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
Updated version
Modified etl::result test
This commit is contained in:
parent
2cdfba4297
commit
ed05c99a9c
@ -38,8 +38,8 @@ SOFTWARE.
|
||||
///\ingroup utilities
|
||||
|
||||
#define ETL_VERSION_MAJOR 20
|
||||
#define ETL_VERSION_MINOR 16
|
||||
#define ETL_VERSION_PATCH 2
|
||||
#define ETL_VERSION_MINOR 17
|
||||
#define ETL_VERSION_PATCH 0
|
||||
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ETL Embedded Template Library",
|
||||
"version": "20.16.2",
|
||||
"version": "20.17.0",
|
||||
"author s": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library ETL
|
||||
version=20.16.2
|
||||
version=20.17.0
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
@ -8,7 +8,7 @@ project('PROJECT_NAME',
|
||||
'cpp_std=c++17', 'build.cpp_std=c++17',
|
||||
],
|
||||
meson_version: '>=0.54.0',
|
||||
version: '20.16.2'
|
||||
version: '20.17.0'
|
||||
)
|
||||
|
||||
######################
|
||||
|
||||
@ -1,5 +1,17 @@
|
||||
===============================================================================
|
||||
20.16.2 Fixed incomplete template specialisations in type_traits.h for C++11
|
||||
20.17.0
|
||||
Added etl::result type
|
||||
Added etl::byte_stream
|
||||
Added denominated etl::to_string overloads
|
||||
Added etl::remove_cvref to type traits
|
||||
Replaced etl::remove_reference_t with etl::remove_cvref_t in variadic etl::variant
|
||||
Added call_if and call_or member functions to etl::delegate
|
||||
Improved compliance with MISRA rules
|
||||
Extended 'successor' handling for all derived message router types
|
||||
|
||||
===============================================================================
|
||||
20.16.2
|
||||
Fixed incomplete template specialisations in type_traits.h for C++11
|
||||
|
||||
===============================================================================
|
||||
20.16.1
|
||||
|
||||
@ -29,101 +29,154 @@ SOFTWARE.
|
||||
#include "unit_test_framework.h"
|
||||
|
||||
#include "etl/result.h"
|
||||
#include "etl/type_traits.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace
|
||||
{
|
||||
struct Value
|
||||
{
|
||||
std::string v;
|
||||
};
|
||||
|
||||
struct ValueM
|
||||
{
|
||||
ValueM()
|
||||
{
|
||||
}
|
||||
|
||||
ValueM(const std::string& v_) : v(v_)
|
||||
{
|
||||
}
|
||||
|
||||
ValueM(ValueM&& other)
|
||||
: v(etl::move(other.v))
|
||||
{
|
||||
}
|
||||
|
||||
ValueM& operator =(ValueM&& rhs)
|
||||
{
|
||||
v = etl::move(rhs.v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//ValueM(const ValueM&) = delete;
|
||||
//ValueM& operator =(const ValueM&) = delete;
|
||||
|
||||
ValueM(const ValueM& other)
|
||||
: v(other.v)
|
||||
{
|
||||
}
|
||||
|
||||
ValueM& operator =(const ValueM& rhs)
|
||||
{
|
||||
v = rhs.v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string v;
|
||||
};
|
||||
|
||||
struct Error
|
||||
{
|
||||
std::string e;
|
||||
};
|
||||
|
||||
struct ErrorM
|
||||
{
|
||||
ErrorM()
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM(const std::string& e_)
|
||||
: e(e_)
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM(ErrorM&& other)
|
||||
: e(etl::move(other.e))
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM& operator =(ErrorM&& rhs)
|
||||
{
|
||||
e = etl::move(rhs.e);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ErrorM(const ErrorM& other)
|
||||
: e(other.e)
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM& operator =(const ErrorM& rhs)
|
||||
{
|
||||
e = rhs.e;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string e;
|
||||
};
|
||||
|
||||
using Result = etl::result<Value, Error>;
|
||||
using ResultV = etl::result<void, Error>;
|
||||
using ResultM = etl::result<ValueM, ErrorM>;
|
||||
}
|
||||
|
||||
// Definitions for when the STL and compiler built-ins are not avalable.
|
||||
#if ETL_NOT_USING_STL && !defined(ETL_USE_TYPE_TRAITS_BUILTINS)
|
||||
|
||||
using etl::is_copy_constructible;
|
||||
using etl::is_move_constructible;
|
||||
|
||||
//*************************
|
||||
template <>
|
||||
struct etl::is_copy_constructible<Value> : public etl::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct etl::is_move_constructible<Value> : public etl::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct etl::is_copy_constructible<Error> : public etl::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct etl::is_move_constructible<Error> : public etl::true_type
|
||||
{
|
||||
};
|
||||
|
||||
//*************************
|
||||
template <>
|
||||
struct etl::is_copy_constructible<ValueM> : public etl::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct etl::is_move_constructible<ValueM> : public etl::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct etl::is_copy_constructible<ErrorM> : public etl::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct etl::is_move_constructible<ErrorM> : public etl::false_type
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
SUITE(test_result)
|
||||
{
|
||||
struct Value
|
||||
{
|
||||
std::string v;
|
||||
};
|
||||
|
||||
struct ValueM
|
||||
{
|
||||
ValueM()
|
||||
{
|
||||
}
|
||||
|
||||
ValueM(const std::string& v_) : v(v_)
|
||||
{
|
||||
}
|
||||
|
||||
ValueM(ValueM&& other)
|
||||
: v(etl::move(other.v))
|
||||
{
|
||||
}
|
||||
|
||||
ValueM& operator =(ValueM&& rhs)
|
||||
{
|
||||
v = etl::move(rhs.v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//ValueM(const ValueM&) = delete;
|
||||
//ValueM& operator =(const ValueM&) = delete;
|
||||
|
||||
ValueM(const ValueM& other)
|
||||
: v(other.v)
|
||||
{
|
||||
}
|
||||
|
||||
ValueM& operator =(const ValueM& rhs)
|
||||
{
|
||||
v = rhs.v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string v;
|
||||
};
|
||||
|
||||
struct Error
|
||||
{
|
||||
std::string e;
|
||||
};
|
||||
|
||||
struct ErrorM
|
||||
{
|
||||
ErrorM()
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM(const std::string& e_)
|
||||
: e(e_)
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM(ErrorM&& other)
|
||||
: e(etl::move(other.e))
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM& operator =(ErrorM&& rhs)
|
||||
{
|
||||
e = etl::move(rhs.e);
|
||||
return *this;
|
||||
}
|
||||
|
||||
ErrorM(const ErrorM& other)
|
||||
: e(other.e)
|
||||
{
|
||||
}
|
||||
|
||||
ErrorM& operator =(const ErrorM& rhs)
|
||||
{
|
||||
e = rhs.e;
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string e;
|
||||
};
|
||||
|
||||
using Result = etl::result<Value, Error>;
|
||||
using ResultV = etl::result<void, Error>;
|
||||
using ResultM = etl::result<ValueM, ErrorM>;
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_constructor_for_result_with_value)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user