Fix clang-tidy modernize-use-bool-literals warnings

This commit is contained in:
Eduardo Almeida
2023-09-09 17:28:41 +01:00
parent 923160b307
commit ba859a0d66
60 changed files with 234 additions and 240 deletions

View File

@@ -163,7 +163,7 @@ main(int argc, char* argv[])
{
for (size_t j = 0; j < Adj_Matrix[i].size(); j++)
{
if (Adj_Matrix[i][j] == 1)
if (Adj_Matrix[i][j])
{
NodeContainer n_links = NodeContainer(nodes.Get(i), nodes.Get(j));
NetDeviceContainer n_devs = p2p.Install(n_links);

View File

@@ -96,8 +96,8 @@ main(int argc, char* argv[])
uint32_t payloadSize = 1472; // bytes
double simulationTime = 10; // seconds
double distance = 5; // meters
bool enablePcap = 0;
bool verifyResults = 0; // used for regression
bool enablePcap = false;
bool verifyResults = false; // used for regression
Time txopLimit = MicroSeconds(4096);
CommandLine cmd(__FILE__);

View File

@@ -84,9 +84,9 @@ main(int argc, char* argv[])
uint32_t payloadSize = 1472; // bytes
double simulationTime = 10; // seconds
double distance = 5; // meters
bool enableRts = 0;
bool enablePcap = 0;
bool verifyResults = 0; // used for regression
bool enableRts = false;
bool enablePcap = false;
bool verifyResults = false; // used for regression
CommandLine cmd(__FILE__);
cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize);

View File

@@ -118,7 +118,7 @@ main(int argc, char* argv[])
double previous = 0;
for (int channelWidth = 20; channelWidth <= 40;)
{
for (int sgi = 0; sgi < 2; sgi++)
for (auto sgi : {false, true})
{
uint32_t payloadSize; // 1500 byte IP packet
if (udp)
@@ -283,11 +283,11 @@ main(int argc, char* argv[])
Simulator::Destroy();
std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << sgi << "\t\t\t"
<< throughput << " Mbit/s" << std::endl;
std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << std::boolalpha
<< sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl;
// test first element
if (mcs == 0 && channelWidth == 20 && sgi == 0)
if (mcs == 0 && channelWidth == 20 && !sgi)
{
if (throughput < minExpectedThroughput)
{
@@ -295,7 +295,7 @@ main(int argc, char* argv[])
}
}
// test last element
if (mcs == 7 && channelWidth == 40 && sgi == 1)
if (mcs == 7 && channelWidth == 40 && sgi)
{
if (maxExpectedThroughput > 0 && throughput > maxExpectedThroughput)
{

View File

@@ -370,7 +370,7 @@ main(int argc, char* argv[])
params.payloadSize = 1472; // bytes
params.simulationTime = 10; // seconds
bool verifyResults = 0; // used for regression
bool verifyResults = false; // used for regression
CommandLine cmd(__FILE__);
cmd.AddValue("payloadSize", "Payload size in bytes", params.payloadSize);

View File

@@ -116,7 +116,7 @@ class Experiment
*/
bool IsRouting() const
{
return (m_enableRouting == 1) ? 1 : 0;
return m_enableRouting;
}
/**
@@ -126,7 +126,7 @@ class Experiment
*/
bool IsMobility() const
{
return (m_enableMobility == 1) ? 1 : 0;
return m_enableMobility;
}
/**
@@ -239,7 +239,7 @@ class Experiment
uint32_t m_gridSize; //!< Grid size.
uint32_t m_nodeDistance; //!< Node distance.
uint32_t m_port; //!< Listening port.
uint32_t m_scenario; //!< Scnario number.
uint32_t m_scenario; //!< Scenario number.
bool m_enablePcap; //!< True if PCAP output is enabled.
bool m_enableTracing; //!< True if tracing output is enabled.

View File

@@ -59,7 +59,7 @@ main(int argc, char* argv[])
double simulationTime = 10; // seconds
uint32_t nMpdus = 1;
uint32_t maxAmpduSize = 0;
bool enableRts = 0;
bool enableRts = false;
double minExpectedThroughput = 0;
double maxExpectedThroughput = 0;

View File

@@ -111,9 +111,9 @@ main(int argc, char* argv[])
double simulationTime = 10; // seconds
double txopLimit = 3520; // microseconds
double distance = 5; // meters
bool enableRts = 0;
bool enablePcap = 0;
bool verifyResults = 0; // used for regression
bool enableRts = false;
bool enablePcap = false;
bool verifyResults = false; // used for regression
CommandLine cmd(__FILE__);
cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize);

View File

@@ -117,7 +117,7 @@ main(int argc, char* argv[])
channelWidth *= 2;
continue;
}
for (int sgi = 0; sgi < 2; sgi++)
for (auto sgi : {false, true})
{
uint32_t payloadSize; // 1500 byte IP packet
if (udp)
@@ -265,11 +265,11 @@ main(int argc, char* argv[])
Simulator::Destroy();
std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << sgi << "\t\t\t"
<< throughput << " Mbit/s" << std::endl;
std::cout << mcs << "\t\t\t" << channelWidth << " MHz\t\t\t" << std::boolalpha
<< sgi << "\t\t\t" << throughput << " Mbit/s" << std::endl;
// test first element
if (mcs == 0 && channelWidth == 20 && sgi == 0)
if (mcs == 0 && channelWidth == 20 && !sgi)
{
if (throughput < minExpectedThroughput)
{
@@ -278,7 +278,7 @@ main(int argc, char* argv[])
}
}
// test last element
if (mcs == 9 && channelWidth == 160 && sgi == 1)
if (mcs == 9 && channelWidth == 160 && sgi)
{
if (maxExpectedThroughput > 0 && throughput > maxExpectedThroughput)
{