A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
assert-example.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2023 Lawrence Livermore National Laboratory
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
7
*/
8
9
/**
10
* \file
11
* \ingroup core-examples
12
* \ingroup assert
13
* Example program illustrating the use of NS_ASSERT_MSG()
14
*/
15
16
#include "ns3/core-module.h"
17
18
#include <iostream>
19
20
using namespace
ns3
;
21
22
NS_LOG_COMPONENT_DEFINE
(
"AssertExample"
);
23
24
int
25
main(
int
argc,
char
** argv)
26
{
27
CommandLine
cmd
;
28
cmd
.Parse(argc, argv);
29
30
std::cout <<
"NS_ASSERT_MSG example\n"
31
<<
" if an argument is given this example will assert.\n"
;
32
33
NS_ASSERT_MSG
(argc == 1,
"An argument was given, so we assert"
);
34
35
return
0;
36
}
ns3::CommandLine
Parse command-line arguments.
Definition
command-line.h:221
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition
assert.h:75
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second.cmd
cmd
Definition
second.py:29
src
core
examples
assert-example.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0