aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-02-05 16:15:30 +0100
committerHarald Welte <laforge@gnumonks.org>2018-02-21 12:08:40 +0000
commit731e2bb328f6b0d739fa21913eb30cff8a46c70c (patch)
tree2c82ae7d2b9ae6317b2a08c1fe6ce06bef458752 /tests
parent77988d469d5cd0d876188a829b93890049cc6830 (diff)
Simplify TS alloc: move slot check into functions
Move timeslot applicability check outside of nested for loop into separate functions and document them. Add corresponding tests. This allows us to clarify types used in TS-related computations. Change-Id: Ic39e848da47dc11357782362fdf6206d2c1457c2 Related: OS#2282
Diffstat (limited to 'tests')
-rw-r--r--tests/alloc/MslotTest.cpp10
-rw-r--r--tests/alloc/MslotTest.ok513
2 files changed, 523 insertions, 0 deletions
diff --git a/tests/alloc/MslotTest.cpp b/tests/alloc/MslotTest.cpp
index 1fa28bf..92f92fa 100644
--- a/tests/alloc/MslotTest.cpp
+++ b/tests/alloc/MslotTest.cpp
@@ -27,6 +27,7 @@
#include <errno.h>
extern "C" {
+ #include "mslot_class.h"
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
@@ -137,6 +138,13 @@ static inline void test_multislot_ends(bool seq)
test_all_classes(trx, seq);
}
+static inline void test_window_wrapper()
+{
+ uint16_t i;
+ for (i = 0; i < 256 * 2 + 1; i++)
+ printf("W[%03u] -> %3u %s\n",
+ i, mslot_wrap_window(i), mslot_wrap_window(i) < 256 ? "OK" : "FAIL");
+}
int main(int argc, char **argv)
{
@@ -163,6 +171,8 @@ int main(int argc, char **argv)
test_multislot_ends(true);
test_multislot_ends(false);
+ test_window_wrapper();
+
return EXIT_SUCCESS;
}
diff --git a/tests/alloc/MslotTest.ok b/tests/alloc/MslotTest.ok
index 86526bf..a47cf57 100644
--- a/tests/alloc/MslotTest.ok
+++ b/tests/alloc/MslotTest.ok
@@ -1730,3 +1730,516 @@ test_multislot_ends(): accumulative
[ACC] multislot class 44 - UL: .......1 DL: .......1 [0]
[ACC] multislot class 45 - UL: .......1 DL: .......1 [0]
[ACC] multislot class 46 - UL: .......1 DL: .......1 [-22]
+W[000] -> 0 OK
+W[001] -> 1 OK
+W[002] -> 2 OK
+W[003] -> 3 OK
+W[004] -> 4 OK
+W[005] -> 5 OK
+W[006] -> 6 OK
+W[007] -> 7 OK
+W[008] -> 8 OK
+W[009] -> 9 OK
+W[010] -> 10 OK
+W[011] -> 11 OK
+W[012] -> 12 OK
+W[013] -> 13 OK
+W[014] -> 14 OK
+W[015] -> 15 OK
+W[016] -> 16 OK
+W[017] -> 17 OK
+W[018] -> 18 OK
+W[019] -> 19 OK
+W[020] -> 20 OK
+W[021] -> 21 OK
+W[022] -> 22 OK
+W[023] -> 23 OK
+W[024] -> 24 OK
+W[025] -> 25 OK
+W[026] -> 26 OK
+W[027] -> 27 OK
+W[028] -> 28 OK
+W[029] -> 29 OK
+W[030] -> 30 OK
+W[031] -> 31 OK
+W[032] -> 32 OK
+W[033] -> 33 OK
+W[034] -> 34 OK
+W[035] -> 35 OK
+W[036] -> 36 OK
+W[037] -> 37 OK
+W[038] -> 38 OK
+W[039] -> 39 OK
+W[040] -> 40 OK
+W[041] -> 41 OK
+W[042] -> 42 OK
+W[043] -> 43 OK
+W[044] -> 44 OK
+W[045] -> 45 OK
+W[046] -> 46 OK
+W[047] -> 47 OK
+W[048] -> 48 OK
+W[049] -> 49 OK
+W[050] -> 50 OK
+W[051] -> 51 OK
+W[052] -> 52 OK
+W[053] -> 53 OK
+W[054] -> 54 OK
+W[055] -> 55 OK
+W[056] -> 56 OK
+W[057] -> 57 OK
+W[058] -> 58 OK
+W[059] -> 59 OK
+W[060] -> 60 OK
+W[061] -> 61 OK
+W[062] -> 62 OK
+W[063] -> 63 OK
+W[064] -> 64 OK
+W[065] -> 65 OK
+W[066] -> 66 OK
+W[067] -> 67 OK
+W[068] -> 68 OK
+W[069] -> 69 OK
+W[070] -> 70 OK
+W[071] -> 71 OK
+W[072] -> 72 OK
+W[073] -> 73 OK
+W[074] -> 74 OK
+W[075] -> 75 OK
+W[076] -> 76 OK
+W[077] -> 77 OK
+W[078] -> 78 OK
+W[079] -> 79 OK
+W[080] -> 80 OK
+W[081] -> 81 OK
+W[082] -> 82 OK
+W[083] -> 83 OK
+W[084] -> 84 OK
+W[085] -> 85 OK
+W[086] -> 86 OK
+W[087] -> 87 OK
+W[088] -> 88 OK
+W[089] -> 89 OK
+W[090] -> 90 OK
+W[091] -> 91 OK
+W[092] -> 92 OK
+W[093] -> 93 OK
+W[094] -> 94 OK
+W[095] -> 95 OK
+W[096] -> 96 OK
+W[097] -> 97 OK
+W[098] -> 98 OK
+W[099] -> 99 OK
+W[100] -> 100 OK
+W[101] -> 101 OK
+W[102] -> 102 OK
+W[103] -> 103 OK
+W[104] -> 104 OK
+W[105] -> 105 OK
+W[106] -> 106 OK
+W[107] -> 107 OK
+W[108] -> 108 OK
+W[109] -> 109 OK
+W[110] -> 110 OK
+W[111] -> 111 OK
+W[112] -> 112 OK
+W[113] -> 113 OK
+W[114] -> 114 OK
+W[115] -> 115 OK
+W[116] -> 116 OK
+W[117] -> 117 OK
+W[118] -> 118 OK
+W[119] -> 119 OK
+W[120] -> 120 OK
+W[121] -> 121 OK
+W[122] -> 122 OK
+W[123] -> 123 OK
+W[124] -> 124 OK
+W[125] -> 125 OK
+W[126] -> 126 OK
+W[127] -> 127 OK
+W[128] -> 128 OK
+W[129] -> 129 OK
+W[130] -> 130 OK
+W[131] -> 131 OK
+W[132] -> 132 OK
+W[133] -> 133 OK
+W[134] -> 134 OK
+W[135] -> 135 OK
+W[136] -> 136 OK
+W[137] -> 137 OK
+W[138] -> 138 OK
+W[139] -> 139 OK
+W[140] -> 140 OK
+W[141] -> 141 OK
+W[142] -> 142 OK
+W[143] -> 143 OK
+W[144] -> 144 OK
+W[145] -> 145 OK
+W[146] -> 146 OK
+W[147] -> 147 OK
+W[148] -> 148 OK
+W[149] -> 149 OK
+W[150] -> 150 OK
+W[151] -> 151 OK
+W[152] -> 152 OK
+W[153] -> 153 OK
+W[154] -> 154 OK
+W[155] -> 155 OK
+W[156] -> 156 OK
+W[157] -> 157 OK
+W[158] -> 158 OK
+W[159] -> 159 OK
+W[160] -> 160 OK
+W[161] -> 161 OK
+W[162] -> 162 OK
+W[163] -> 163 OK
+W[164] -> 164 OK
+W[165] -> 165 OK
+W[166] -> 166 OK
+W[167] -> 167 OK
+W[168] -> 168 OK
+W[169] -> 169 OK
+W[170] -> 170 OK
+W[171] -> 171 OK
+W[172] -> 172 OK
+W[173] -> 173 OK
+W[174] -> 174 OK
+W[175] -> 175 OK
+W[176] -> 176 OK
+W[177] -> 177 OK
+W[178] -> 178 OK
+W[179] -> 179 OK
+W[180] -> 180 OK
+W[181] -> 181 OK
+W[182] -> 182 OK
+W[183] -> 183 OK
+W[184] -> 184 OK
+W[185] -> 185 OK
+W[186] -> 186 OK
+W[187] -> 187 OK
+W[188] -> 188 OK
+W[189] -> 189 OK
+W[190] -> 190 OK
+W[191] -> 191 OK
+W[192] -> 192 OK
+W[193] -> 193 OK
+W[194] -> 194 OK
+W[195] -> 195 OK
+W[196] -> 196 OK
+W[197] -> 197 OK
+W[198] -> 198 OK
+W[199] -> 199 OK
+W[200] -> 200 OK
+W[201] -> 201 OK
+W[202] -> 202 OK
+W[203] -> 203 OK
+W[204] -> 204 OK
+W[205] -> 205 OK
+W[206] -> 206 OK
+W[207] -> 207 OK
+W[208] -> 208 OK
+W[209] -> 209 OK
+W[210] -> 210 OK
+W[211] -> 211 OK
+W[212] -> 212 OK
+W[213] -> 213 OK
+W[214] -> 214 OK
+W[215] -> 215 OK
+W[216] -> 216 OK
+W[217] -> 217 OK
+W[218] -> 218 OK
+W[219] -> 219 OK
+W[220] -> 220 OK
+W[221] -> 221 OK
+W[222] -> 222 OK
+W[223] -> 223 OK
+W[224] -> 224 OK
+W[225] -> 225 OK
+W[226] -> 226 OK
+W[227] -> 227 OK
+W[228] -> 228 OK
+W[229] -> 229 OK
+W[230] -> 230 OK
+W[231] -> 231 OK
+W[232] -> 232 OK
+W[233] -> 233 OK
+W[234] -> 234 OK
+W[235] -> 235 OK
+W[236] -> 236 OK
+W[237] -> 237 OK
+W[238] -> 238 OK
+W[239] -> 239 OK
+W[240] -> 240 OK
+W[241] -> 241 OK
+W[242] -> 242 OK
+W[243] -> 243 OK
+W[244] -> 244 OK
+W[245] -> 245 OK
+W[246] -> 246 OK
+W[247] -> 247 OK
+W[248] -> 248 OK
+W[249] -> 249 OK
+W[250] -> 250 OK
+W[251] -> 251 OK
+W[252] -> 252 OK
+W[253] -> 253 OK
+W[254] -> 254 OK
+W[255] -> 255 OK
+W[256] -> 1 OK
+W[257] -> 1 OK
+W[258] -> 3 OK
+W[259] -> 3 OK
+W[260] -> 5 OK
+W[261] -> 5 OK
+W[262] -> 7 OK
+W[263] -> 7 OK
+W[264] -> 9 OK
+W[265] -> 9 OK
+W[266] -> 11 OK
+W[267] -> 11 OK
+W[268] -> 13 OK
+W[269] -> 13 OK
+W[270] -> 15 OK
+W[271] -> 15 OK
+W[272] -> 17 OK
+W[273] -> 17 OK
+W[274] -> 19 OK
+W[275] -> 19 OK
+W[276] -> 21 OK
+W[277] -> 21 OK
+W[278] -> 23 OK
+W[279] -> 23 OK
+W[280] -> 25 OK
+W[281] -> 25 OK
+W[282] -> 27 OK
+W[283] -> 27 OK
+W[284] -> 29 OK
+W[285] -> 29 OK
+W[286] -> 31 OK
+W[287] -> 31 OK
+W[288] -> 33 OK
+W[289] -> 33 OK
+W[290] -> 35 OK
+W[291] -> 35 OK
+W[292] -> 37 OK
+W[293] -> 37 OK
+W[294] -> 39 OK
+W[295] -> 39 OK
+W[296] -> 41 OK
+W[297] -> 41 OK
+W[298] -> 43 OK
+W[299] -> 43 OK
+W[300] -> 45 OK
+W[301] -> 45 OK
+W[302] -> 47 OK
+W[303] -> 47 OK
+W[304] -> 49 OK
+W[305] -> 49 OK
+W[306] -> 51 OK
+W[307] -> 51 OK
+W[308] -> 53 OK
+W[309] -> 53 OK
+W[310] -> 55 OK
+W[311] -> 55 OK
+W[312] -> 57 OK
+W[313] -> 57 OK
+W[314] -> 59 OK
+W[315] -> 59 OK
+W[316] -> 61 OK
+W[317] -> 61 OK
+W[318] -> 63 OK
+W[319] -> 63 OK
+W[320] -> 65 OK
+W[321] -> 65 OK
+W[322] -> 67 OK
+W[323] -> 67 OK
+W[324] -> 69 OK
+W[325] -> 69 OK
+W[326] -> 71 OK
+W[327] -> 71 OK
+W[328] -> 73 OK
+W[329] -> 73 OK
+W[330] -> 75 OK
+W[331] -> 75 OK
+W[332] -> 77 OK
+W[333] -> 77 OK
+W[334] -> 79 OK
+W[335] -> 79 OK
+W[336] -> 81 OK
+W[337] -> 81 OK
+W[338] -> 83 OK
+W[339] -> 83 OK
+W[340] -> 85 OK
+W[341] -> 85 OK
+W[342] -> 87 OK
+W[343] -> 87 OK
+W[344] -> 89 OK
+W[345] -> 89 OK
+W[346] -> 91 OK
+W[347] -> 91 OK
+W[348] -> 93 OK
+W[349] -> 93 OK
+W[350] -> 95 OK
+W[351] -> 95 OK
+W[352] -> 97 OK
+W[353] -> 97 OK
+W[354] -> 99 OK
+W[355] -> 99 OK
+W[356] -> 101 OK
+W[357] -> 101 OK
+W[358] -> 103 OK
+W[359] -> 103 OK
+W[360] -> 105 OK
+W[361] -> 105 OK
+W[362] -> 107 OK
+W[363] -> 107 OK
+W[364] -> 109 OK
+W[365] -> 109 OK
+W[366] -> 111 OK
+W[367] -> 111 OK
+W[368] -> 113 OK
+W[369] -> 113 OK
+W[370] -> 115 OK
+W[371] -> 115 OK
+W[372] -> 117 OK
+W[373] -> 117 OK
+W[374] -> 119 OK
+W[375] -> 119 OK
+W[376] -> 121 OK
+W[377] -> 121 OK
+W[378] -> 123 OK
+W[379] -> 123 OK
+W[380] -> 125 OK
+W[381] -> 125 OK
+W[382] -> 127 OK
+W[383] -> 127 OK
+W[384] -> 129 OK
+W[385] -> 129 OK
+W[386] -> 131 OK
+W[387] -> 131 OK
+W[388] -> 133 OK
+W[389] -> 133 OK
+W[390] -> 135 OK
+W[391] -> 135 OK
+W[392] -> 137 OK
+W[393] -> 137 OK
+W[394] -> 139 OK
+W[395] -> 139 OK
+W[396] -> 141 OK
+W[397] -> 141 OK
+W[398] -> 143 OK
+W[399] -> 143 OK
+W[400] -> 145 OK
+W[401] -> 145 OK
+W[402] -> 147 OK
+W[403] -> 147 OK
+W[404] -> 149 OK
+W[405] -> 149 OK
+W[406] -> 151 OK
+W[407] -> 151 OK
+W[408] -> 153 OK
+W[409] -> 153 OK
+W[410] -> 155 OK
+W[411] -> 155 OK
+W[412] -> 157 OK
+W[413] -> 157 OK
+W[414] -> 159 OK
+W[415] -> 159 OK
+W[416] -> 161 OK
+W[417] -> 161 OK
+W[418] -> 163 OK
+W[419] -> 163 OK
+W[420] -> 165 OK
+W[421] -> 165 OK
+W[422] -> 167 OK
+W[423] -> 167 OK
+W[424] -> 169 OK
+W[425] -> 169 OK
+W[426] -> 171 OK
+W[427] -> 171 OK
+W[428] -> 173 OK
+W[429] -> 173 OK
+W[430] -> 175 OK
+W[431] -> 175 OK
+W[432] -> 177 OK
+W[433] -> 177 OK
+W[434] -> 179 OK
+W[435] -> 179 OK
+W[436] -> 181 OK
+W[437] -> 181 OK
+W[438] -> 183 OK
+W[439] -> 183 OK
+W[440] -> 185 OK
+W[441] -> 185 OK
+W[442] -> 187 OK
+W[443] -> 187 OK
+W[444] -> 189 OK
+W[445] -> 189 OK
+W[446] -> 191 OK
+W[447] -> 191 OK
+W[448] -> 193 OK
+W[449] -> 193 OK
+W[450] -> 195 OK
+W[451] -> 195 OK
+W[452] -> 197 OK
+W[453] -> 197 OK
+W[454] -> 199 OK
+W[455] -> 199 OK
+W[456] -> 201 OK
+W[457] -> 201 OK
+W[458] -> 203 OK
+W[459] -> 203 OK
+W[460] -> 205 OK
+W[461] -> 205 OK
+W[462] -> 207 OK
+W[463] -> 207 OK
+W[464] -> 209 OK
+W[465] -> 209 OK
+W[466] -> 211 OK
+W[467] -> 211 OK
+W[468] -> 213 OK
+W[469] -> 213 OK
+W[470] -> 215 OK
+W[471] -> 215 OK
+W[472] -> 217 OK
+W[473] -> 217 OK
+W[474] -> 219 OK
+W[475] -> 219 OK
+W[476] -> 221 OK
+W[477] -> 221 OK
+W[478] -> 223 OK
+W[479] -> 223 OK
+W[480] -> 225 OK
+W[481] -> 225 OK
+W[482] -> 227 OK
+W[483] -> 227 OK
+W[484] -> 229 OK
+W[485] -> 229 OK
+W[486] -> 231 OK
+W[487] -> 231 OK
+W[488] -> 233 OK
+W[489] -> 233 OK
+W[490] -> 235 OK
+W[491] -> 235 OK
+W[492] -> 237 OK
+W[493] -> 237 OK
+W[494] -> 239 OK
+W[495] -> 239 OK
+W[496] -> 241 OK
+W[497] -> 241 OK
+W[498] -> 243 OK
+W[499] -> 243 OK
+W[500] -> 245 OK
+W[501] -> 245 OK
+W[502] -> 247 OK
+W[503] -> 247 OK
+W[504] -> 249 OK
+W[505] -> 249 OK
+W[506] -> 251 OK
+W[507] -> 251 OK
+W[508] -> 253 OK
+W[509] -> 253 OK
+W[510] -> 255 OK
+W[511] -> 255 OK
+W[512] -> 2 OK