From 440479be65e9893ff256692d3d2342e99134052a Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Mon, 7 May 2007 13:45:30 +0200 Subject: [PATCH] add more tests --- src/core/ns-unknown-manager.cc | 42 ++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/core/ns-unknown-manager.cc b/src/core/ns-unknown-manager.cc index 6b18a5389..dc7120b15 100644 --- a/src/core/ns-unknown-manager.cc +++ b/src/core/ns-unknown-manager.cc @@ -98,47 +98,47 @@ class A : public ns3::NsUnknown public: static const ns3::ClassId cidZero; static const ns3::ClassId cidOneBool; - static const ns3::ClassId cidOneInt; + static const ns3::ClassId cidOneUi32; static const ns3::Iid iid; A (); A (bool); - A (int); + A (uint32_t); bool m_zeroInvoked; bool m_oneBoolInvoked; - bool m_oneIntInvoked; + bool m_oneUi32Invoked; bool m_bool; - int m_int; + int m_ui32; }; const ns3::ClassId A::cidZero = ns3::NsUnknownManager::RegisterConstructor ("A"); const ns3::ClassId A::cidOneBool = ns3::NsUnknownManager::RegisterConstructor ("ABool"); -const ns3::ClassId A::cidOneInt = ns3::NsUnknownManager::RegisterConstructor ("AInt"); +const ns3::ClassId A::cidOneUi32 = ns3::NsUnknownManager::RegisterConstructor ("AUi32"); const ns3::Iid A::iid ("IA"); A::A () : NsUnknown (A::iid), m_zeroInvoked (true), m_oneBoolInvoked (false), - m_oneIntInvoked (false) + m_oneUi32Invoked (false) {} A::A (bool b) : NsUnknown (A::iid), m_zeroInvoked (false), m_oneBoolInvoked (true), - m_oneIntInvoked (false), + m_oneUi32Invoked (false), m_bool (b) {} -A::A (int i) +A::A (uint32_t i) : NsUnknown (A::iid), m_zeroInvoked (false), m_oneBoolInvoked (false), - m_oneIntInvoked (true), - m_int (i) + m_oneUi32Invoked (true), + m_ui32 (i) {} } @@ -169,7 +169,7 @@ NsUnknownManagerTest::RunTests (void) } a->Unref (); - a = NsUnknownManager::Create (A::cidOneBool, A::iid, true); + a = NsUnknownManager::Create (A::cidOneBool, A::iid, true); if (a == 0 || !a->m_oneBoolInvoked || !a->m_bool) @@ -178,7 +178,7 @@ NsUnknownManagerTest::RunTests (void) } a->Unref (); - a = NsUnknownManager::Create (A::cidOneBool, A::iid, false); + a = NsUnknownManager::Create (A::cidOneBool, A::iid, false); if (a == 0 || !a->m_oneBoolInvoked || a->m_bool) @@ -187,6 +187,24 @@ NsUnknownManagerTest::RunTests (void) } a->Unref (); + a = NsUnknownManager::Create (A::cidOneUi32, A::iid, 10); + if (a == 0 || + !a->m_oneUi32Invoked || + a->m_ui32 != 10) + { + ok = false; + } + a->Unref (); + + a = NsUnknownManager::Create (A::cidOneUi32, A::iid, (uint32_t)10); + if (a == 0 || + !a->m_oneUi32Invoked || + a->m_ui32 != 10) + { + ok = false; + } + a->Unref (); + return ok; }