[test] define all unit tests in ot namespace (#9617)

This commit updates unit test modules to be defined under the `ot`
namespace. This aligns all the unit tests to follow the same
model, eliminating the need to use `ot::` prefix in unit test
code.
This commit is contained in:
Abtin Keshavarzian
2023-11-19 18:40:20 -08:00
committed by GitHub
parent b77573586c
commit 23c0fc4d4b
28 changed files with 436 additions and 389 deletions
+11 -7
View File
@@ -35,12 +35,14 @@
#include "test_util.h"
namespace ot {
struct EntryBase
{
EntryBase *mNext;
};
struct Entry : public EntryBase, ot::LinkedListEntry<Entry>
struct Entry : public EntryBase, LinkedListEntry<Entry>
{
public:
Entry(void)
@@ -48,7 +50,7 @@ public:
{
}
void Init(ot::Instance &) { mInitWithInstance = true; }
void Init(Instance &) { mInitWithInstance = true; }
bool IsInitializedWithInstance(void) const { return mInitWithInstance; }
@@ -61,7 +63,7 @@ enum : uint16_t
kPoolSize = 11,
};
typedef ot::Pool<Entry, kPoolSize> EntryPool;
typedef Pool<Entry, kPoolSize> EntryPool;
static Entry sNonPoolEntry;
@@ -118,9 +120,9 @@ void TestPool(EntryPool &aPool, bool aInitWithInstance)
void TestPool(void)
{
ot::Instance *instance = testInitInstance();
EntryPool pool1;
EntryPool pool2(*instance);
Instance *instance = testInitInstance();
EntryPool pool1;
EntryPool pool2(*instance);
TestPool(pool1, /* aInitWithInstance */ false);
TestPool(pool2, /* aInitWithInstance */ true);
@@ -128,9 +130,11 @@ void TestPool(void)
testFreeInstance(instance);
}
} // namespace ot
int main(void)
{
TestPool();
ot::TestPool();
printf("All tests passed\n");
return 0;
}