src/core/callback-test.cc
changeset 150 663120712cd9
parent 133 8a8e9891792d
child 345 47b41507a45a
--- a/src/core/callback-test.cc	Wed Nov 01 13:00:34 2006 +0100
+++ b/src/core/callback-test.cc	Wed Nov 01 13:11:30 2006 +0100
@@ -1,4 +1,4 @@
-/* -*- Mode:NS3; -*- */
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
  * Copyright (c) 2005,2006 INRIA
  * All rights reserved.
@@ -33,164 +33,164 @@
 
 void Test5 (void)
 {
-    gTest5 = true;
+  gTest5 = true;
 }
 
 void Test6 (int)
 {
-    gTest6 = true;
+  gTest6 = true;
 }
 
 int Test7 (int a)
 {
-    gTest7 = true;
-    return a;
+  gTest7 = true;
+  return a;
 }
 
 class CallbackTest : public ns3::Test {
 private:
-    bool m_test1;
-    bool m_test2;
-    bool m_test3;
-    bool m_test4;
+  bool m_test1;
+  bool m_test2;
+  bool m_test3;
+  bool m_test4;
 public:
-    CallbackTest ();
-    virtual bool RunTests (void);
-    void Reset (void);
-    bool IsWrong (void);
-    void Test1 (void);
-    int Test2 (void);
-    void Test3 (double a);
-    int Test4 (double a, int b);
-    void Test8 (Callback<void, int> callback);
+  CallbackTest ();
+  virtual bool RunTests (void);
+  void Reset (void);
+  bool IsWrong (void);
+  void Test1 (void);
+  int Test2 (void);
+  void Test3 (double a);
+  int Test4 (double a, int b);
+  void Test8 (Callback<void, int> callback);
 };
 
 CallbackTest::CallbackTest ()
-    : ns3::Test ("Callback"),
-      m_test1 (false),
-      m_test2 (false),
-      m_test3 (false),
-      m_test4 (false)
+  : ns3::Test ("Callback"),
+    m_test1 (false),
+    m_test2 (false),
+    m_test3 (false),
+    m_test4 (false)
 {}
 
 void 
 CallbackTest::Test1 (void)
 {
-    m_test1 = true;
+  m_test1 = true;
 }
 int 
 CallbackTest::Test2 (void)
 {
-    m_test2 = true;
-    return 2;
+  m_test2 = true;
+  return 2;
 }
 void 
 CallbackTest::Test3 (double a)
 {
-    m_test3 = true;
+  m_test3 = true;
 }
 int 
 CallbackTest::Test4 (double a, int b)
 {
-    m_test4 = true;
-    return 4;
+  m_test4 = true;
+  return 4;
 }
 void
 CallbackTest::Test8 (Callback<void,int> callback)
 {
-    callback (3);
+  callback (3);
 }
 bool
 CallbackTest::IsWrong (void)
 {
-    if (!m_test1 ||
-        !m_test2 ||
-        !m_test3 ||
-        !m_test4 ||
-        !gTest5 ||
-        !gTest6 ||
-        !gTest7) 
-      {
-        return true;
-      }
-    return false;
+  if (!m_test1 ||
+      !m_test2 ||
+      !m_test3 ||
+      !m_test4 ||
+      !gTest5 ||
+      !gTest6 ||
+      !gTest7) 
+    {
+      return true;
+    }
+  return false;
 }
 
 void
 CallbackTest::Reset (void)
 {
-    m_test1 = false;
-    m_test2 = false;
-    m_test3 = false;
-    m_test4 = false;
-    gTest5 = false;
-    gTest6 = false;
-    gTest7 = false;
+  m_test1 = false;
+  m_test2 = false;
+  m_test3 = false;
+  m_test4 = false;
+  gTest5 = false;
+  gTest6 = false;
+  gTest7 = false;
 }
 
   
 bool 
 CallbackTest::RunTests (void)
 {
-    bool ok = true;
+  bool ok = true;
 
-    typedef ns3::Callback<void> A;
-    typedef ns3::Callback<int> B;
-    typedef ns3::Callback<void, double> C;
-    typedef ns3::Callback<int, double, int> D;
-    typedef ns3::Callback<void> E;
-    typedef ns3::Callback<void,int> F;
-    typedef ns3::Callback<int,int> G;
-    
-    A a0 (this, &CallbackTest::Test1);
-    B b0;
-    b0 = B (this, &CallbackTest::Test2);
-    C c0 = C (this, &CallbackTest::Test3);
-    D d0 = D (this, &CallbackTest::Test4);
-    E e0 = E (&Test5);
-    F f0 = F (&Test6);
-    G g0 = G (&Test7);
+  typedef ns3::Callback<void> A;
+  typedef ns3::Callback<int> B;
+  typedef ns3::Callback<void, double> C;
+  typedef ns3::Callback<int, double, int> D;
+  typedef ns3::Callback<void> E;
+  typedef ns3::Callback<void,int> F;
+  typedef ns3::Callback<int,int> G;
+  
+  A a0 (this, &CallbackTest::Test1);
+  B b0;
+  b0 = B (this, &CallbackTest::Test2);
+  C c0 = C (this, &CallbackTest::Test3);
+  D d0 = D (this, &CallbackTest::Test4);
+  E e0 = E (&Test5);
+  F f0 = F (&Test6);
+  G g0 = G (&Test7);
 
-    a0 ();
-    b0 ();
-    c0 (0.0);
-    d0 (0.0, 1);
-    e0 ();
-    f0 (1);
-    g0 (1);
+  a0 ();
+  b0 ();
+  c0 (0.0);
+  d0 (0.0, 1);
+  e0 ();
+  f0 (1);
+  g0 (1);
 
-    if (IsWrong ()) 
-      {
-        ok = false;
-      }
+  if (IsWrong ()) 
+    {
+      ok = false;
+    }
 
-    Reset ();
+  Reset ();
 
-    A a1 = ns3::MakeCallback (&CallbackTest::Test1, this);
-    B b1 = ns3::MakeCallback (&CallbackTest::Test2, this);
-    C c1 = ns3::MakeCallback (&CallbackTest::Test3, this);
-    D d1 = ns3::MakeCallback (&CallbackTest::Test4, this);
-    E e1 = ns3::MakeCallback (&Test5);
-    F f1 = ns3::MakeCallback (&Test6);
-    G g1 = ns3::MakeCallback (&Test7);
-    
-    a1 ();
-    b1 ();
-    c1 (0.0);
-    d1 (0.0, 1);
-    e1 ();
-    f1 (1);
-    g1 (2);
+  A a1 = ns3::MakeCallback (&CallbackTest::Test1, this);
+  B b1 = ns3::MakeCallback (&CallbackTest::Test2, this);
+  C c1 = ns3::MakeCallback (&CallbackTest::Test3, this);
+  D d1 = ns3::MakeCallback (&CallbackTest::Test4, this);
+  E e1 = ns3::MakeCallback (&Test5);
+  F f1 = ns3::MakeCallback (&Test6);
+  G g1 = ns3::MakeCallback (&Test7);
+  
+  a1 ();
+  b1 ();
+  c1 (0.0);
+  d1 (0.0, 1);
+  e1 ();
+  f1 (1);
+  g1 (2);
 
-    Test8 (f1);
+  Test8 (f1);
 
-    Callback<void, int64_t,int64_t> a2;
+  Callback<void, int64_t,int64_t> a2;
 
-    if (IsWrong ()) 
-      {
-        ok = false;
-      }
-    return ok;
+  if (IsWrong ()) 
+    {
+      ok = false;
+    }
+  return ok;
 }
 
 static CallbackTest gCallbackTest;