Skip to content

Commit

Permalink
Fix test namespace conflicts in TestSetup and TestTeardown
Browse files Browse the repository at this point in the history
  • Loading branch information
lpbeliveau-silabs authored and pull[bot] committed Jul 22, 2023
1 parent 757dcf0 commit 5603797
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
11 changes: 6 additions & 5 deletions src/app/tests/TestExtensionFieldSets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

using namespace chip;

namespace {
namespace TestEFS {

enum class TagTestEFS : uint8_t
{
Expand Down Expand Up @@ -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.
*/
Expand All @@ -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() };

Expand Down
26 changes: 11 additions & 15 deletions src/app/tests/TestSceneTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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;
}
Expand All @@ -938,21 +934,21 @@ int TestSetup(void * inContext)
*/
int TestTeardown(void * inContext)
{
sSceneTable.Finish();
TestScenes::sSceneTable.Finish();
chip::Platform::MemoryShutdown();

return SUCCESS;
}

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() };

Expand Down

0 comments on commit 5603797

Please sign in to comment.