aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/alloc/AllocTest.cpp21
-rw-r--r--tests/alloc/AllocTest.err2
-rw-r--r--tests/alloc/AllocTest.ok2
3 files changed, 20 insertions, 5 deletions
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index 95a6cb6e..70c85519 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -47,9 +47,11 @@ static gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts,
return tbf_alloc_dl_tbf(bts, ms, tfi, trx, ms_class, single_slot);
}
-static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
+static void test_alloc_a(gprs_rlcmac_tbf_direction dir,
+ uint8_t slots, const int count)
{
int tfi;
+ int i;
uint8_t used_trx;
BTS the_bts;
struct gprs_rlcmac_bts *bts;
@@ -61,8 +63,11 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
bts->alloc_algorithm = alloc_algorithm_a;
struct gprs_rlcmac_trx *trx = &bts->trx[0];
- trx->pdch[2].enable();
- trx->pdch[3].enable();
+ for (i = 0; i < 8; i += 1)
+ if (slots & (1 << i))
+ trx->pdch[i].enable();
+
+ OSMO_ASSERT(count >= 0 && count <= (int)ARRAY_SIZE(tbfs));
/**
* Currently alloc_a will only allocate from the first
@@ -74,6 +79,7 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
tfi = the_bts.tfi_find_free(dir, &used_trx, 0);
OSMO_ASSERT(tfi >= 0);
tbfs[i] = tbf_alloc(bts, NULL, dir, tfi, used_trx, 0, 0);
+ OSMO_ASSERT(tbfs[i] != NULL);
}
/* Now check that there are still some TFIs */
@@ -102,8 +108,13 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
static void test_alloc_a()
{
- test_alloc_a(GPRS_RLCMAC_DL_TBF, 32);
- test_alloc_a(GPRS_RLCMAC_UL_TBF, 7);
+ /* slots 2 - 3 */
+ test_alloc_a(GPRS_RLCMAC_DL_TBF, 0x0c, 32);
+ test_alloc_a(GPRS_RLCMAC_UL_TBF, 0x0c, 7);
+
+ /* slots 1 - 5 */
+ test_alloc_a(GPRS_RLCMAC_DL_TBF, 0x1e, 32);
+ test_alloc_a(GPRS_RLCMAC_UL_TBF, 0x1e, 7);
}
static void dump_assignment(struct gprs_rlcmac_tbf *tbf, const char *dir)
diff --git a/tests/alloc/AllocTest.err b/tests/alloc/AllocTest.err
index 23eea09a..db956017 100644
--- a/tests/alloc/AllocTest.err
+++ b/tests/alloc/AllocTest.err
@@ -1,5 +1,7 @@
No TFI available.
- Failed allocating TS=2, no USF available
+No TFI available.
+- Failed allocating TS=1, no USF available
- Failed allocating TS=3, no USF available
No suitable uplink slots available
No suitable uplink slots available
diff --git a/tests/alloc/AllocTest.ok b/tests/alloc/AllocTest.ok
index f5df0f8f..89393fc3 100644
--- a/tests/alloc/AllocTest.ok
+++ b/tests/alloc/AllocTest.ok
@@ -1,5 +1,7 @@
Testing alloc_a direction(0)
Testing alloc_a direction(1)
+Testing alloc_a direction(0)
+Testing alloc_a direction(1)
Going to test multislot assignment MS_CLASS=0
Testing UL then DL assignment.
PDCH[6] is used for UL