Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CheckValue for the case when expected is a saved enum value. (#28108
Browse files Browse the repository at this point in the history
)

Fixes #28096
bzbarsky-apple authored and pull[bot] committed Jan 18, 2024
1 parent d5c0949 commit 5271016
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/tests/suites/include/ValueChecker.h
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ class ValueChecker

// Allow a different expected type from the actual value type, because if T
// is short the literal we are using is not short-typed.
template <typename T, typename U, typename std::enable_if_t<!std::is_enum<T>::value, int> = 0>
template <typename T, typename U, typename std::enable_if_t<!std::is_enum<T>::value && !std::is_enum<U>::value, int> = 0>
bool CheckValue(const char * itemName, T current, U expected)
{
if (current != expected)
@@ -82,6 +82,12 @@ class ValueChecker
return true;
}

template <typename T, typename U, typename std::enable_if_t<!std::is_enum<T>::value && std::is_enum<U>::value, int> = 0>
bool CheckValue(const char * itemName, T current, U expected)
{
return CheckValue(itemName, current, chip::to_underlying(expected));
}

template <typename T, typename U, typename std::enable_if_t<std::is_enum<T>::value, int> = 0>
bool CheckValue(const char * itemName, T current, U expected)
{

0 comments on commit 5271016

Please sign in to comment.