View | Details | Raw Unified | Return to bug 699
Collapse All | Expand All

(-)a/src/core/test.cc (-6 / +7 lines)
 Lines 21-26    Link Here 
21
#include "abort.h"
21
#include "abort.h"
22
#include <math.h>
22
#include <math.h>
23
23
24
// Set to true to enable a segmentation fault upon a test case macro test 
25
// failing (for debugging purposes)
24
bool gBreakOnFailure = false;
26
bool gBreakOnFailure = false;
25
27
26
namespace ns3 {
28
namespace ns3 {
 Lines 138-144    Link Here 
138
  DoReportStart ();
140
  DoReportStart ();
139
}
141
}
140
142
141
bool
143
void
142
TestCase::Run (void)
144
TestCase::Run (void)
143
{
145
{
144
  //
146
  //
 Lines 150-157    Link Here 
150
  DoReportStart ();
152
  DoReportStart ();
151
  DoSetup ();
153
  DoSetup ();
152
154
153
  bool result = DoRun ();
155
  DoRun ();
154
  UpdateErrorStatus (result);
155
156
156
  DoTeardown ();
157
  DoTeardown ();
157
158
 Lines 175-181    Link Here 
175
176
176
  DoReportEnd ();
177
  DoReportEnd ();
177
178
178
  return GetErrorStatus ();
179
  return;
179
}
180
}
180
181
181
void 
182
void 
 Lines 682-689    Link Here 
682
      //
683
      //
683
      // Run the test case
684
      // Run the test case
684
      //
685
      //
685
      bool result = (*i)->Run ();
686
      (*i)->Run ();
686
      UpdateErrorStatus (result);
687
      UpdateErrorStatus ((*i)->GetErrorStatus ());
687
688
688
      //
689
      //
689
      // Exit if we have detected an error and we are not allowing multiple filures
690
      // Exit if we have detected an error and we are not allowing multiple filures
(-)a/src/core/test.h (-15 / +7 lines)
 Lines 51-62    Link Here 
51
#define NS_TEST_SOURCEDIR \
51
#define NS_TEST_SOURCEDIR \
52
  TestCase::GetSourceDir (__FILE__)
52
  TestCase::GetSourceDir (__FILE__)
53
53
54
#define NS_TEST_RETURN_IF_ERROR \
55
  if (GetErrorStatus ()) \
56
    {                    \
57
      return true;       \
58
    } 
59
60
// ===========================================================================
54
// ===========================================================================
61
// Test for equality (generic version)
55
// Test for equality (generic version)
62
// ===========================================================================
56
// ===========================================================================
 Lines 79-85    Link Here 
79
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);          \
73
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);          \
80
        if (!ContinueOnFailure ())                                                                      \
74
        if (!ContinueOnFailure ())                                                                      \
81
          {                                                                                             \
75
          {                                                                                             \
82
            return true;                                                                                \
76
            return;                                                                                     \
83
          }                                                                                             \
77
          }                                                                                             \
84
      }                                                                                                 \
78
      }                                                                                                 \
85
  } while (false)
79
  } while (false)
 Lines 189-195    Link Here 
189
        ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
183
        ReportTestFailure (condStream.str (), actualStream.str (), limitStream.str (), msgStream.str (), file, line); \
190
        if (!ContinueOnFailure ())                                                                                    \
184
        if (!ContinueOnFailure ())                                                                                    \
191
          {                                                                                                           \
185
          {                                                                                                           \
192
            return true;                                                                                              \
186
            return;                                                                                                   \
193
          }                                                                                                           \
187
          }                                                                                                           \
194
      }                                                                                                               \
188
      }                                                                                                               \
195
  } while (false)
189
  } while (false)
 Lines 342-348    Link Here 
342
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);          \
336
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);          \
343
        if (!ContinueOnFailure ())                                                                      \
337
        if (!ContinueOnFailure ())                                                                      \
344
          {                                                                                             \
338
          {                                                                                             \
345
            return true;                                                                                \
339
            return;                                                                                     \
346
          }                                                                                             \
340
          }                                                                                             \
347
      }                                                                                                 \
341
      }                                                                                                 \
348
  } while (false)
342
  } while (false)
 Lines 447-453    Link Here 
447
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);           \
441
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);           \
448
        if (!ContinueOnFailure ())                                                                       \
442
        if (!ContinueOnFailure ())                                                                       \
449
          {                                                                                              \
443
          {                                                                                              \
450
            return true;                                                                                 \
444
            return;                                                                                      \
451
          }                                                                                              \
445
          }                                                                                              \
452
      }                                                                                                  \
446
      }                                                                                                  \
453
  } while (false)
447
  } while (false)
 Lines 531-537    Link Here 
531
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);           \
525
                       actualStream.str (), limitStream.str (), msgStream.str (), file, line);           \
532
        if (!ContinueOnFailure ())                                                                       \
526
        if (!ContinueOnFailure ())                                                                       \
533
          {                                                                                              \
527
          {                                                                                              \
534
            return true;                                                                                 \
528
            return;                                                                                      \
535
          }                                                                                              \
529
          }                                                                                              \
536
      }                                                                                                  \
530
      }                                                                                                  \
537
  } while (false)
531
  } while (false)
 Lines 626-634    Link Here 
626
620
627
  /**
621
  /**
628
   * \brief Run this test case.
622
   * \brief Run this test case.
629
   * \returns Boolean sense of "an error has occurred."
630
   */
623
   */
631
  bool Run (void);
624
  void Run (void);
632
625
633
  /**
626
  /**
634
   * \brief Set the verbosity of this test case.
627
   * \brief Set the verbosity of this test case.
 Lines 829-837    Link Here 
829
  /**
822
  /**
830
   * \internal
823
   * \internal
831
   * \brief Implementation to actually run this test case.
824
   * \brief Implementation to actually run this test case.
832
   * \returns Boolean sense of "an error has occurred."
833
   */
825
   */
834
  virtual bool DoRun (void) = 0;
826
  virtual void DoRun (void) = 0;
835
827
836
  /**
828
  /**
837
   * \internal
829
   * \internal

Return to bug 699