--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/core/type-traits-test-suite.cc Thu Sep 24 23:48:35 2009 -0700
@@ -0,0 +1,66 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2009 University of Washington
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "type-traits.h"
+#include "test.h"
+
+namespace ns3 {
+
+class TypeTraitsTestCase : public TestCase
+{
+public:
+ TypeTraitsTestCase ();
+ virtual ~TypeTraitsTestCase () {}
+
+private:
+ virtual bool DoRun (void);
+};
+
+TypeTraitsTestCase::TypeTraitsTestCase (void)
+ : TestCase ("Check type traits")
+{
+}
+
+bool
+TypeTraitsTestCase::DoRun (void)
+{
+ NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void)>::IsPointerToMember, 1, "Check");
+ NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void) const>::IsPointerToMember, 1, "Check");
+ NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int)>::IsPointerToMember, 1, "Check");
+ NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::IsPointerToMember, 1, "Check");
+ NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (void) const>::PointerToMemberTraits::nArgs, 0, "Check");
+ NS_TEST_ASSERT_MSG_EQ (TypeTraits<void (TypeTraitsTestCase::*) (int) const>::PointerToMemberTraits::nArgs, 1, "Check");
+
+ return GetErrorStatus ();
+}
+
+class TypeTraitsTestSuite : public TestSuite
+{
+public:
+ TypeTraitsTestSuite ();
+};
+
+TypeTraitsTestSuite::TypeTraitsTestSuite ()
+ : TestSuite ("type-traits", UNIT)
+{
+ AddTestCase (new TypeTraitsTestCase);
+}
+
+TypeTraitsTestSuite typeTraitsTestSuite;
+
+} // namespace ns3
--- a/src/core/type-traits-test.cc Thu Sep 24 12:15:33 2009 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#include "type-traits.h"
-#include "test.h"
-
-#ifdef RUN_SELF_TESTS
-
-namespace ns3 {
-
-class TypeTraitsTest : public Test
-{
-public:
- TypeTraitsTest ();
- virtual bool RunTests (void);
-};
-
-TypeTraitsTest::TypeTraitsTest ()
- : Test ("TypeTraits")
-{}
-bool
-TypeTraitsTest::RunTests (void)
-{
- bool result = true;
-
- //TypeTraits<int &>::ReferencedType ir;
- //TypeTraits<const int>::NonConstType uci;
- NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void)>::IsPointerToMember, 1);
- NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void) const>::IsPointerToMember, 1);
- NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int)>::IsPointerToMember, 1);
- NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int) const>::IsPointerToMember, 1);
- NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (void) const>::PointerToMemberTraits::nArgs, 0);
- NS_TEST_ASSERT_EQUAL (TypeTraits<void (TypeTraitsTest::*) (int) const>::PointerToMemberTraits::nArgs, 1);
-
- return result;
-}
-
-static TypeTraitsTest g_typeTraitsTest;
-
-} // namespace ns3
-
-#endif /* RUN_SELF_TESTS */
-
--- a/src/core/wscript Thu Sep 24 12:15:33 2009 -0700
+++ b/src/core/wscript Thu Sep 24 23:48:35 2009 -0700
@@ -60,7 +60,6 @@
'rng-stream.cc',
'command-line.cc',
'type-name.cc',
- 'type-traits-test.cc',
'attribute.cc',
'boolean.cc',
'integer.cc',
@@ -80,6 +79,7 @@
'vector.cc',
'names-test-suite.cc',
'attribute-test-suite.cc',
+ 'type-traits-test-suite.cc',
]
headers = bld.new_task_gen('ns3header')