From 5a2681f337fe3607b7ab64fa00a4298f359941b3 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 28 Oct 2024 11:30:52 -0400 Subject: [PATCH 1/3] Another try to make efr32 build of tests happy --- .../tests/TestEmberAttributeDataBuffer.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp b/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp index 438e35b427515c..4dfa3d97740340 100644 --- a/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp +++ b/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp @@ -37,7 +37,6 @@ #include -#include #include #include @@ -114,7 +113,7 @@ template <> bool IsEqual(const float & a, const float & b) { - if (std::isnan(a) && std::isnan(b)) + if (isnan(a) && isnan(b)) { return true; } @@ -126,7 +125,7 @@ template <> bool IsEqual(const double & a, const double & b) { - if (std::isnan(a) && std::isnan(b)) + if (isnan(a) && isnan(b)) { return true; } @@ -1157,7 +1156,7 @@ TEST(TestEmberAttributeBuffer, TestDecodeFloatingPoint) { EncodeTester tester(CreateFakeMeta(ZCL_SINGLE_ATTRIBUTE_TYPE, false /* nullable */)); // non-nullable float - EXPECT_TRUE(tester.TryDecode(std::nan("0"), { 0, 0, 0xC0, 0x7F }).IsSuccess()); + EXPECT_TRUE(tester.TryDecode(NAN, { 0, 0, 0xC0, 0x7F }).IsSuccess()); } { @@ -1177,6 +1176,6 @@ TEST(TestEmberAttributeBuffer, TestDecodeFloatingPoint) { EncodeTester tester(CreateFakeMeta(ZCL_DOUBLE_ATTRIBUTE_TYPE, false /* nullable */)); // non-nullable double - EXPECT_TRUE(tester.TryDecode(std::nan("0"), { 0, 0, 0, 0, 0, 0, 0xF8, 0x7F }).IsSuccess()); + EXPECT_TRUE(tester.TryDecode(NAN, { 0, 0, 0, 0, 0, 0, 0xF8, 0x7F }).IsSuccess()); } } From a0ec78b9c118ca4c4045256c2c9bbaf6723dd562 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 28 Oct 2024 11:51:44 -0400 Subject: [PATCH 2/3] Move includes around, to try to work around issues within efr32 compiles... --- .../tests/TestEmberAttributeDataBuffer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp b/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp index 4dfa3d97740340..3feb8f80f21c53 100644 --- a/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp +++ b/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp @@ -16,6 +16,8 @@ */ #include +#include + #include #include @@ -35,7 +37,6 @@ #include #include -#include #include #include From 8276b4d331ed7d45332f7761c1215b4a889d9300 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 28 Oct 2024 11:59:41 -0400 Subject: [PATCH 3/3] more updates, this time local efr32 compiles --- .../tests/TestEmberAttributeDataBuffer.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp b/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp index 3feb8f80f21c53..04e8b94dcce809 100644 --- a/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp +++ b/src/app/codegen-data-model-provider/tests/TestEmberAttributeDataBuffer.cpp @@ -37,7 +37,6 @@ #include #include - #include #include @@ -113,8 +112,7 @@ bool IsEqual(const T & a, const T & b) template <> bool IsEqual(const float & a, const float & b) { - - if (isnan(a) && isnan(b)) + if (std::isnan(a) && std::isnan(b)) { return true; } @@ -125,8 +123,7 @@ bool IsEqual(const float & a, const float & b) template <> bool IsEqual(const double & a, const double & b) { - - if (isnan(a) && isnan(b)) + if (std::isnan(a) && std::isnan(b)) { return true; } @@ -1157,7 +1154,7 @@ TEST(TestEmberAttributeBuffer, TestDecodeFloatingPoint) { EncodeTester tester(CreateFakeMeta(ZCL_SINGLE_ATTRIBUTE_TYPE, false /* nullable */)); // non-nullable float - EXPECT_TRUE(tester.TryDecode(NAN, { 0, 0, 0xC0, 0x7F }).IsSuccess()); + EXPECT_TRUE(tester.TryDecode(std::nanf("0"), { 0, 0, 0xC0, 0x7F }).IsSuccess()); } { @@ -1177,6 +1174,6 @@ TEST(TestEmberAttributeBuffer, TestDecodeFloatingPoint) { EncodeTester tester(CreateFakeMeta(ZCL_DOUBLE_ATTRIBUTE_TYPE, false /* nullable */)); // non-nullable double - EXPECT_TRUE(tester.TryDecode(NAN, { 0, 0, 0, 0, 0, 0, 0xF8, 0x7F }).IsSuccess()); + EXPECT_TRUE(tester.TryDecode(std::nan("0"), { 0, 0, 0, 0, 0, 0, 0xF8, 0x7F }).IsSuccess()); } }