mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Added tests for message base_type
This commit is contained in:
parent
c6dc700cf3
commit
de6e6ab13c
@ -209,7 +209,7 @@ namespace etl
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// Is T derived from etl::message<>
|
||||
/// Is T an etl::message<> or derived from etl::message<>
|
||||
//***************************************************************************
|
||||
template <typename T>
|
||||
struct is_message_type : public etl::bool_constant<etl::is_base_of<etl::message_tag, typename etl::remove_cvref<T>::type>::value>
|
||||
@ -225,7 +225,7 @@ namespace etl
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
/// Is T a user defined base of etl::message<T>
|
||||
/// Is T a user defined base of etl::message<T> and not an etl::imessage
|
||||
//***************************************************************************
|
||||
template <typename T>
|
||||
struct is_user_message_base : public etl::bool_constant<etl::is_message_base<T>::value && !is_imessage<T>::value>
|
||||
|
||||
@ -114,4 +114,19 @@ SUITE(test_message)
|
||||
CHECK_FALSE(etl::is_user_message_base<int>::value);
|
||||
#endif
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_message_base_type)
|
||||
{
|
||||
struct Message1 : public etl::message<1> {};
|
||||
|
||||
struct MessageBase : public etl::imessage {};
|
||||
struct Message2 : public etl::message<2, MessageBase> {};
|
||||
|
||||
CHECK_TRUE((std::is_same_v<etl::imessage, Message1::base_type>));
|
||||
CHECK_TRUE((std::is_same_v<MessageBase, Message2::base_type>));
|
||||
|
||||
CHECK_FALSE((std::is_same_v<MessageBase, Message1::base_type>));
|
||||
CHECK_FALSE((std::is_same_v<etl::imessage, Message2::base_type>));
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user