Skip to content

Commit a3aa696

Browse files
committed
[#3163] remove EXPECT_EQ_MARGIN, EXPECT_IN_RANGE
They're longer used. Replaced with the official EXPECT_NEAR.
1 parent 4891f55 commit a3aa696

File tree

1 file changed

+0
-48
lines changed

1 file changed

+0
-48
lines changed

src/lib/testutils/gtest_utils.h

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -118,54 +118,6 @@ namespace test {
118118
}
119119
#endif
120120

121-
/// @brief Expect two values to be equal with a given margin of error.
122-
///
123-
/// Output is similar to official gtest expect macro outputs.
124-
/// Static casts avoid comparison of integers of different signs.
125-
///
126-
/// @param val1 the first value being tested
127-
/// @param val2 the second value being tested
128-
/// @param margin the allowed margin of error
129-
#define EXPECT_EQ_MARGIN(val1_statement, val2_statement, margin_statement) \
130-
{ \
131-
auto const val1(val1_statement); \
132-
auto const val2(static_cast<decltype(val1)>(val2_statement)); \
133-
auto const margin(static_cast<decltype(val1)>(margin_statement)); \
134-
if (val1 < val2 && val1 + margin < val2 || val2 < val1 && val2 + margin < val1) { \
135-
ADD_FAILURE() << "Expected equality of these values:\n" \
136-
<< " " << #val1_statement << "\n" \
137-
<< " Which is: " << val1 << "\n" \
138-
<< " " << #val2_statement << "\n" \
139-
<< " Which is: " << val2 << "\n" \
140-
<< "With a margin of error of:\n" \
141-
<< " " << #margin_statement << "\n" \
142-
<< " Which is: " << margin << ""; \
143-
} \
144-
}
145-
146-
/// @brief Expect a value to be between two other given values.
147-
///
148-
/// Output is similar to official gtest expect macro outputs.
149-
/// Static casts avoid comparison of integers of different signs.
150-
///
151-
/// @param value_statement the statement for the value being tested
152-
/// @param low_statement the low reference value being tested against
153-
/// @param high_statement the high reference value being tested against
154-
#define EXPECT_IN_RANGE(value_statement, low_statement, high_statement) \
155-
{ \
156-
auto const value(value_statement); \
157-
auto const low(static_cast<decltype(value)>(low_statement)); \
158-
auto const high(static_cast<decltype(value)>(high_statement)); \
159-
if (value < low || high < value) { \
160-
ADD_FAILURE() << "Expected this value:\n" \
161-
<< " " << #value_statement << "\n" \
162-
<< " Which is: " << value << "\n" \
163-
<< "To be in range:\n" \
164-
<< " [" << #low_statement << ", " << #high_statement << "]\n" \
165-
<< " Which is: [" << low << ", " << high << "]"; \
166-
} \
167-
}
168-
169121
} // namespace test
170122
} // namespace isc
171123

0 commit comments

Comments
 (0)