@@ -54,6 +54,7 @@ const int32_t test_HopSequenceTable [129] = { 4,93,31,84,55,3,116,123,
54
54
77 ,48 ,100 ,51 ,14 ,21 ,94 ,23 ,
55
55
22 };
56
56
57
+
57
58
bool test_tr51_get_rand ()
58
59
{
59
60
tr51_seed_rand (1 );
@@ -143,3 +144,53 @@ bool test_tr51_calculate_hopping_sequence()
143
144
144
145
return true;
145
146
}
147
+
148
+ bool test_dh1cf_get_uc_channel_index ()
149
+ {
150
+ int32_t test_dh1cf_channel_table_1 [10 ] = {19 , 128 , 3 , 53 , 79 , 24 , 68 , 118 , 7 , 51 };
151
+ uint8_t mac_1 [8 ] = {0x00 , 0x13 , 0x50 , 0x04 , 0x00 , 0x00 , 0x05 , 0xf8 };
152
+ int i ;
153
+ // Test generating channel table for specific MAC addresses and slot numbers
154
+ for (i = 0 ; i < 10 ; i ++ ) {
155
+ if (test_dh1cf_channel_table_1 [i ] != dh1cf_get_uc_channel_index (10738 + i , mac_1 , 129 )) {
156
+ return false;
157
+ }
158
+ }
159
+
160
+ int32_t test_dh1cf_channel_table_2 [10 ] = {82 , 47 , 102 , 83 , 89 , 5 , 23 , 121 , 70 , 98 };
161
+ uint8_t mac_2 [8 ] = {0x00 , 0x13 , 0x50 , 0x04 , 0x00 , 0x00 , 0x06 , 0x02 };
162
+
163
+ for (i = 0 ; i < 10 ; i ++ ) {
164
+ if (test_dh1cf_channel_table_2 [i ] != dh1cf_get_uc_channel_index (16446 + i , mac_2 , 129 )) {
165
+ return false;
166
+ }
167
+ }
168
+ return true;
169
+ }
170
+
171
+ bool test_dh1cf_get_bc_channel_index ()
172
+ {
173
+ int32_t test_dh1cf_channel_table_1 [10 ] = {107 , 46 , 75 , 88 , 27 , 23 , 114 , 86 , 75 , 115 };
174
+ int i ;
175
+ // Test generating channel table for specific broadcast schedule identifiers and slot numbers
176
+ for (i = 0 ; i < 10 ; i ++ ) {
177
+ if (test_dh1cf_channel_table_1 [i ] != dh1cf_get_bc_channel_index (10738 + i , 1 , 129 )) {
178
+ return false;
179
+ }
180
+ }
181
+ int32_t test_dh1cf_channel_table_2 [10 ] = {112 , 122 , 121 , 22 , 54 , 91 , 116 , 14 , 102 , 68 };
182
+ for (i = 0 ; i < 10 ; i ++ ) {
183
+ if (test_dh1cf_channel_table_2 [i ] != dh1cf_get_bc_channel_index (10738 + i , 2 , 129 )) {
184
+ return false;
185
+ }
186
+ }
187
+
188
+ int32_t test_dh1cf_channel_table_3 [10 ] = {60 , 96 , 3 , 120 , 8 , 109 , 80 , 42 , 96 , 91 };
189
+ for (i = 0 ; i < 10 ; i ++ ) {
190
+ if (test_dh1cf_channel_table_3 [i ] != dh1cf_get_bc_channel_index (10738 + i , 100 , 129 )) {
191
+ return false;
192
+ }
193
+
194
+ }
195
+ return true;
196
+ }
0 commit comments