summaryrefslogtreecommitdiffstats
path: root/tests/gsm0408
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-10-31 13:35:22 +0100
committerpespin <pespin@sysmocom.de>2019-11-03 23:21:06 +0000
commitb99f4ca2d8517d99cdf8aa183dbfda7b233bb781 (patch)
treeb12807696a4f5056473f7561e544aa004183c6ef /tests/gsm0408
parent2ceb758ba4a845898fbff11bd4942751078b8ee7 (diff)
gsm_04_08.h: Introduce API osmo_gsm48_rfpowercap2powerclass()
Related: OS#4244 Change-Id: I32e9cc1c2397b44f0d48db2acdf782a821365b63
Diffstat (limited to 'tests/gsm0408')
-rw-r--r--tests/gsm0408/gsm0408_test.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/gsm0408/gsm0408_test.c b/tests/gsm0408/gsm0408_test.c
index db1d45ad..2488024a 100644
--- a/tests/gsm0408/gsm0408_test.c
+++ b/tests/gsm0408/gsm0408_test.c
@@ -26,6 +26,7 @@
#include <osmocom/gsm/gsm48_ie.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/gsm48_arfcn_range_encode.h>
+#include <osmocom/gsm/gsm_utils.h>
#include <osmocom/gsm/mncc.h>
#include <osmocom/core/backtrace.h>
#include <osmocom/core/utils.h>
@@ -1132,6 +1133,28 @@ static void test_si_range_helpers()
VERIFY(f0, ==, 1);
}
+static void test_power_ctrl()
+{
+ int8_t rc8;
+
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_850, 0x00);
+ VERIFY(rc8, ==, 1);
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_900, 0x02);
+ VERIFY(rc8, ==, 3);
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_1800, 0x02);
+ VERIFY(rc8, ==, 3);
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_1900, 0x02);
+ VERIFY(rc8, ==, 3);
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_1900, 0x04);
+ VERIFY(rc8, <, 0);
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_900, 0x04);
+ VERIFY(rc8, ==, 5);
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_900, 0x05);
+ VERIFY(rc8, <, 0);
+ rc8 = osmo_gsm48_rfpowercap2powerclass(GSM_BAND_900, 0xf2);
+ VERIFY(rc8, <, 0);
+}
+
int main(int argc, char **argv)
{
test_bearer_cap();
@@ -1147,6 +1170,7 @@ int main(int argc, char **argv)
test_arfcn_filter();
test_print_encoding();
test_range_encoding();
+ test_power_ctrl();
return EXIT_SUCCESS;
}