author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Fri, 26 Oct 2007 14:14:20 +0200 | |
changeset 2036 | 0cb3c7151e89 |
parent 324 | 7571b28edc22 |
permissions | -rw-r--r-- |
268
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
2 |
#include "ns3/debug.h" |
276
58651aff818b
split out assert from debug.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
275
diff
changeset
|
3 |
#include "ns3/assert.h" |
268
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
4 |
|
275
0732d4283cc2
regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
272
diff
changeset
|
5 |
NS_DEBUG_COMPONENT_DEFINE ("MyComponentA"); |
268
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
6 |
|
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
// declare other function |
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
namespace foo { |
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
void OneFunction (void); |
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
} |
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
|
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
int main (int argc, int argv) |
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
{ |
275
0732d4283cc2
regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
272
diff
changeset
|
14 |
NS_DEBUG ("nargc="<<argc); |
268
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
|
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
foo::OneFunction (); |
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
|
275
0732d4283cc2
regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
272
diff
changeset
|
18 |
NS_DEBUG ("other debug output"); |
269
c79be9d4110a
add NS3_ASSERT and NS3_ASSERT_MSG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
268
diff
changeset
|
19 |
|
272
8639c0a2d309
avoid warning in optimized builds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
269
diff
changeset
|
20 |
int a; |
8639c0a2d309
avoid warning in optimized builds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
269
diff
changeset
|
21 |
a = 0; |
269
c79be9d4110a
add NS3_ASSERT and NS3_ASSERT_MSG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
268
diff
changeset
|
22 |
|
275
0732d4283cc2
regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
272
diff
changeset
|
23 |
NS_ASSERT (a == 0); |
0732d4283cc2
regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
272
diff
changeset
|
24 |
NS_ASSERT_MSG (a == 0, "my msg"); |
324
7571b28edc22
make trailing ';' mandatory for NS_ASSERT* and NS_FATAL_ERROR macros. fix uses.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
276
diff
changeset
|
25 |
NS_ASSERT (a != 0); |
275
0732d4283cc2
regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
272
diff
changeset
|
26 |
NS_ASSERT_MSG (a != 0, "my 2 msg"); |
268
a43b635230e8
test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
} |