Skip to content

Commit 3be099b

Browse files
committed
Fix warnings generated by NetworkConfigTest (#2469)
This test was generating a warning about unused vairables. Unless built in debug mode, `aserts`are often optimized out we should be using the `ASSERT` macros from `gtest` instead. Signed-off-by: Arjo Chakravarty <arjoc@google.com>
1 parent cd9a855 commit 3be099b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/network/NetworkConfig_TEST.cc

+8-12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*
1616
*/
1717

18+
1819
#include <gtest/gtest.h>
1920

2021
#include <gz/common/Console.hh>
@@ -30,38 +31,33 @@ TEST(NetworkManager, ValueConstructor)
3031
{
3132
// Primary without number of secondaries is invalid
3233
auto config = NetworkConfig::FromValues("PRIMARY", 0);
33-
assert(config.role == NetworkRole::None);
34-
assert(config.numSecondariesExpected == 0);
34+
ASSERT_EQ(config.role, NetworkRole::None);
35+
ASSERT_EQ(config.numSecondariesExpected, 0);
3536
// Expect console warning as well
36-
(void) config;
3737
}
3838

3939
{
4040
// Primary with number of secondaries is valid
4141
auto config = NetworkConfig::FromValues("PRIMARY", 3);
42-
assert(config.role == NetworkRole::SimulationPrimary);
43-
assert(config.numSecondariesExpected == 3);
44-
(void) config;
42+
ASSERT_EQ(config.role, NetworkRole::SimulationPrimary);
43+
ASSERT_EQ(config.numSecondariesExpected, 3);
4544
}
4645

4746
{
4847
// Secondary is always valid
4948
auto config = NetworkConfig::FromValues("SECONDARY", 0);
50-
assert(config.role == NetworkRole::SimulationSecondary);
51-
(void) config;
49+
ASSERT_EQ(config.role, NetworkRole::SimulationSecondary);
5250
}
5351

5452
{
5553
// Readonly is always valid
5654
auto config = NetworkConfig::FromValues("READONLY");
57-
assert(config.role == NetworkRole::ReadOnly);
58-
(void) config;
55+
ASSERT_EQ(config.role, NetworkRole::ReadOnly);
5956
}
6057

6158
{
6259
// Anything else is invalid
6360
auto config = NetworkConfig::FromValues("READ_WRITE");
64-
assert(config.role == NetworkRole::None);
65-
(void) config;
61+
ASSERT_EQ(config.role, NetworkRole::None);
6662
}
6763
}

0 commit comments

Comments
 (0)