From b3d55973a83360f5303742cd254aa976f6c9fbaf Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Wed, 22 Mar 2023 14:35:33 -0400 Subject: [PATCH] Fix test namespace conflicts in TestSetup and TestTeardown --- src/app/tests/TestExtensionFieldSets.cpp | 11 +++++----- src/app/tests/TestSceneTable.cpp | 26 ++++++++++-------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/app/tests/TestExtensionFieldSets.cpp b/src/app/tests/TestExtensionFieldSets.cpp index 3181a5410ff216..ce363462cb6fee 100644 --- a/src/app/tests/TestExtensionFieldSets.cpp +++ b/src/app/tests/TestExtensionFieldSets.cpp @@ -24,7 +24,7 @@ using namespace chip; -namespace { +namespace TestEFS { enum class TagTestEFS : uint8_t { @@ -304,7 +304,7 @@ void TestRemoveExtensionFieldSet(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, true == EFS->IsEmpty()); } -} // namespace +} // namespace TestEFS /** * Tear down the test suite. */ @@ -327,9 +327,10 @@ int TestTeardown(void * inContext) int TestExtensionFieldSets() { - static nlTest sTests[] = { NL_TEST_DEF("TestInsertExtensionFieldSet", TestInsertExtensionFieldSet), - NL_TEST_DEF("TestSerializeDerializeExtensionFieldSet", TestSerializeDerializeExtensionFieldSet), - NL_TEST_DEF("TestRemoveExtensionFieldSet", TestRemoveExtensionFieldSet), + static nlTest sTests[] = { NL_TEST_DEF("TestInsertExtensionFieldSet", TestEFS::TestInsertExtensionFieldSet), + NL_TEST_DEF("TestSerializeDerializeExtensionFieldSet", + TestEFS::TestSerializeDerializeExtensionFieldSet), + NL_TEST_DEF("TestRemoveExtensionFieldSet", TestEFS::TestRemoveExtensionFieldSet), NL_TEST_SENTINEL() }; diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp index 54a3c22db4644b..607152b1aea4be 100644 --- a/src/app/tests/TestSceneTable.cpp +++ b/src/app/tests/TestSceneTable.cpp @@ -34,11 +34,7 @@ using SceneData = scenes::DefaultSceneTableImpl::SceneData; using ExtensionFieldSet = scenes::ExtensionFieldSet; using TransitionTimeMs = scenes::TransitionTimeMs; -namespace { - -// Group constants -constexpr uint16_t kMaxGroupsPerFabric = 5; -constexpr uint16_t kMaxGroupKeysPerFabric = 4; +namespace TestScenes { // Test Cluster ID constexpr chip::ClusterId kOnOffClusterId = 0x0006; @@ -918,7 +914,7 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); } -} // namespace +} // namespace TestScenes /** * Tear down the test suite. @@ -928,7 +924,7 @@ int TestSetup(void * inContext) VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); // Initialize Scene Table - VerifyOrReturnError(CHIP_NO_ERROR == sSceneTable.Init(&testStorage), FAILURE); + VerifyOrReturnError(CHIP_NO_ERROR == TestScenes::sSceneTable.Init(&TestScenes::testStorage), FAILURE); return SUCCESS; } @@ -938,7 +934,7 @@ int TestSetup(void * inContext) */ int TestTeardown(void * inContext) { - sSceneTable.Finish(); + TestScenes::sSceneTable.Finish(); chip::Platform::MemoryShutdown(); return SUCCESS; @@ -946,13 +942,13 @@ int TestTeardown(void * inContext) int TestSceneTable() { - static nlTest sTests[] = { NL_TEST_DEF("TestHandlerRegistration", TestHandlerRegistration), - NL_TEST_DEF("TestHandlerFunctions", TestHandlerFunctions), - NL_TEST_DEF("TestStoreScenes", TestStoreScenes), - NL_TEST_DEF("TestOverwriteScenes", TestOverwriteScenes), - NL_TEST_DEF("TestIterateScenes", TestIterateScenes), - NL_TEST_DEF("TestRemoveScenes", TestRemoveScenes), - NL_TEST_DEF("TestFabricScenes", TestFabricScenes), + static nlTest sTests[] = { NL_TEST_DEF("TestHandlerRegistration", TestScenes::TestHandlerRegistration), + NL_TEST_DEF("TestHandlerFunctions", TestScenes::TestHandlerFunctions), + NL_TEST_DEF("TestStoreScenes", TestScenes::TestStoreScenes), + NL_TEST_DEF("TestOverwriteScenes", TestScenes::TestOverwriteScenes), + NL_TEST_DEF("TestIterateScenes", TestScenes::TestIterateScenes), + NL_TEST_DEF("TestRemoveScenes", TestScenes::TestRemoveScenes), + NL_TEST_DEF("TestFabricScenes", TestScenes::TestFabricScenes), NL_TEST_SENTINEL() };