This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged. ( https://gerrit.osmocom.org/13051 )
Change subject: EDGE tests: reduce code duplication
......................................................................
EDGE tests: reduce code duplication
* move duplicated code into helper function
* use proper parameter types
Change-Id: I8a9528032629e5df629996da5cd8b808efede017
---
M tests/edge/EdgeTest.cpp
1 file changed, 15 insertions(+), 8 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/tests/edge/EdgeTest.cpp b/tests/edge/EdgeTest.cpp
index 98ca206..6ce2334 100644
--- a/tests/edge/EdgeTest.cpp
+++ b/tests/edge/EdgeTest.cpp
@@ -105,11 +105,22 @@
}
+static bool check_strong_monotonicity(const GprsCodingScheme *cs, uint8_t last_UL, uint8_t last_DL)
+{
+ if (cs->maxBytesUL() <= last_UL)
+ return false;
+
+ if (cs->maxBytesDL() <= last_DL)
+ return false;
+
+ return true;
+}
+
static void test_coding_scheme()
{
unsigned i;
- unsigned last_size_UL;
- unsigned last_size_DL;
+ uint8_t last_size_UL;
+ uint8_t last_size_DL;
GprsCodingScheme::Scheme gprs_schemes[] = {
GprsCodingScheme::CS1,
GprsCodingScheme::CS2,
@@ -152,9 +163,7 @@
OSMO_ASSERT(GprsCodingScheme::Scheme(current_cs) == gprs_schemes[i]);
OSMO_ASSERT(current_cs == GprsCodingScheme(gprs_schemes[i]));
- /* Check strong monotonicity */
- OSMO_ASSERT(current_cs.maxBytesUL() > last_size_UL);
- OSMO_ASSERT(current_cs.maxBytesDL() > last_size_DL);
+ OSMO_ASSERT(check_strong_monotonicity(¤t_cs, last_size_UL, last_size_DL));
last_size_UL = current_cs.maxBytesUL();
last_size_DL = current_cs.maxBytesDL();
@@ -179,9 +188,7 @@
OSMO_ASSERT(GprsCodingScheme::Scheme(current_cs) == egprs_schemes[i].s);
OSMO_ASSERT(current_cs == GprsCodingScheme(egprs_schemes[i].s));
- /* Check strong monotonicity */
- OSMO_ASSERT(current_cs.maxBytesUL() > last_size_UL);
- OSMO_ASSERT(current_cs.maxBytesDL() > last_size_DL);
+ OSMO_ASSERT(check_strong_monotonicity(¤t_cs, last_size_UL, last_size_DL));
last_size_UL = current_cs.maxBytesUL();
last_size_DL = current_cs.maxBytesDL();
--
To view, visit https://gerrit.osmocom.org/13051
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I8a9528032629e5df629996da5cd8b808efede017
Gerrit-Change-Number: 13051
Gerrit-PatchSet: 2
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Daniel Willmann <dwillmann at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190226/70326b30/attachment.htm>