Max has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/51/13051/1 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: newchange Gerrit-Change-Id: I8a9528032629e5df629996da5cd8b808efede017 Gerrit-Change-Number: 13051 Gerrit-PatchSet: 1 Gerrit-Owner: Max <msur...@sysmocom.de>