aboutsummaryrefslogtreecommitdiffstats
path: root/tests/types
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2016-01-14 13:40:01 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2016-02-08 00:45:35 +0100
commit419b03497555eec53bc5759f6838d6a464987b99 (patch)
treed0ac081971671149d81bd40029fa00986e27578d /tests/types
parentb41262fa0bc7edb64e518839923933a3480d1d48 (diff)
tbf: Use bitvec based window methods for GPRS
Currently the old fixed 64 bit RBB based implementation is used for GPRS. Use the new bitvec based methods instead. Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests/types')
-rw-r--r--tests/types/TypesTest.cpp56
-rw-r--r--tests/types/TypesTest.ok3
2 files changed, 56 insertions, 3 deletions
diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index 3447f695..c56b125a 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -327,8 +327,12 @@ static void test_rlc_dl_ul_basic()
{
uint16_t lost = 0, recv = 0;
char show_rbb[65];
+ uint8_t bits_data[8];
BTS dummy_bts;
gprs_rlc_dl_window dl_win;
+ bitvec bits;
+ int bsn_begin, bsn_end, num_blocks;
+ Ack_Nack_Description_t desc;
dl_win.m_v_b.reset();
@@ -348,13 +352,61 @@ static void test_rlc_dl_ul_basic()
}
uint8_t rbb_cmp[8] = { 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff };
- Decoding::extract_rbb(rbb_cmp, show_rbb);
+ bits.data = bits_data;
+ bits.data_len = sizeof(bits_data);
+ bits.cur_bit = 0;
+
+ memcpy(desc.RECEIVED_BLOCK_BITMAP, rbb_cmp,
+ sizeof(desc.RECEIVED_BLOCK_BITMAP));
+ desc.FINAL_ACK_INDICATION = 0;
+ desc.STARTING_SEQUENCE_NUMBER = 35;
+
+ num_blocks = Decoding::decode_gprs_acknack_bits(
+ &desc, &bits,
+ &bsn_begin, &bsn_end, &dl_win);
+ Decoding::extract_rbb(&bits, show_rbb);
printf("show_rbb: %s\n", show_rbb);
- dl_win.update(&dummy_bts, show_rbb, 35, &lost, &recv);
+ dl_win.update(&dummy_bts, &bits, 0, &lost, &recv);
OSMO_ASSERT(lost == 0);
OSMO_ASSERT(recv == 35);
+ OSMO_ASSERT(bsn_begin == 0);
+ OSMO_ASSERT(bsn_end == 35);
+ OSMO_ASSERT(num_blocks == 35);
+ dl_win.raise(dl_win.move_window());
+
+ for (int i = 0; i < 8; ++i) {
+ dl_win.increment_send();
+ OSMO_ASSERT(!dl_win.window_empty());
+ OSMO_ASSERT(dl_win.distance() == 2 + i);
+ }
+
+ uint8_t rbb_cmp2[8] = { 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0x31 };
+ bits.data = bits_data;
+ bits.data_len = sizeof(bits_data);
+ bits.cur_bit = 0;
+
+ memcpy(desc.RECEIVED_BLOCK_BITMAP, rbb_cmp2,
+ sizeof(desc.RECEIVED_BLOCK_BITMAP));
+ desc.FINAL_ACK_INDICATION = 0;
+ desc.STARTING_SEQUENCE_NUMBER = 35 + 8;
+
+ num_blocks = Decoding::decode_gprs_acknack_bits(
+ &desc, &bits,
+ &bsn_begin, &bsn_end, &dl_win);
+ Decoding::extract_rbb(&bits, show_rbb);
+ printf("show_rbb: %s\n", show_rbb);
+
+ lost = recv = 0;
+ dl_win.update(&dummy_bts, &bits, 0, &lost, &recv);
+ OSMO_ASSERT(lost == 5);
+ OSMO_ASSERT(recv == 3);
+ OSMO_ASSERT(bitvec_get_bit_pos(&bits, 0) == 0);
+ OSMO_ASSERT(bitvec_get_bit_pos(&bits, 7) == 1);
+ OSMO_ASSERT(bsn_begin == 35);
+ OSMO_ASSERT(bsn_end == 43);
+ OSMO_ASSERT(num_blocks == 8);
}
}
diff --git a/tests/types/TypesTest.ok b/tests/types/TypesTest.ok
index 6ca2717c..cb40d398 100644
--- a/tests/types/TypesTest.ok
+++ b/tests/types/TypesTest.ok
@@ -4,4 +4,5 @@ rbb: 00 00 00 00 00 00 00 01
rbb: 00 00 00 00 00 00 00 03
rbb: 00 00 00 00 00 00 00 31
rbb: 10 00 00 00 00 00 00 01
-show_rbb: IIIIIIIIIIIIIIIIIIIIIIIIIIIIIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
+show_rbb: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
+show_rbb: IIRRIIIR