From 14022807c8f0cdb3cdfc9bb304db78cedd1ec27f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 20 Jul 2023 17:01:18 -0400 Subject: [PATCH] Fix CheckValue for the case when expected is a saved enum value. (#28108) Fixes https://github.com/project-chip/connectedhomeip/issues/28096 --- src/app/tests/suites/include/ValueChecker.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/tests/suites/include/ValueChecker.h b/src/app/tests/suites/include/ValueChecker.h index d629626f4cd11d..3fa032a4db638a 100644 --- a/src/app/tests/suites/include/ValueChecker.h +++ b/src/app/tests/suites/include/ValueChecker.h @@ -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 ::value, int> = 0> + template ::value && !std::is_enum::value, int> = 0> bool CheckValue(const char * itemName, T current, U expected) { if (current != expected) @@ -82,6 +82,12 @@ class ValueChecker return true; } + template ::value && std::is_enum::value, int> = 0> + bool CheckValue(const char * itemName, T current, U expected) + { + return CheckValue(itemName, current, chip::to_underlying(expected)); + } + template ::value, int> = 0> bool CheckValue(const char * itemName, T current, U expected) {