@@ -86,10 +86,13 @@ bool test_tr51_get_uc_channel_index()
86
86
int i ;
87
87
uint16_t number_of_channels = 129 ;
88
88
int32_t channel ;
89
+ int16_t channel_table [number_of_channels ];
89
90
int32_t test_table [number_of_channels ];
90
91
uint8_t mac [8 ] = {0x00 , 0x13 , 0x50 , 0x04 , 0x00 , 0x00 , 0x05 , 0xf8 };
92
+
93
+ tr51_init_channel_table (channel_table , number_of_channels );
91
94
for (i = 0 ; i < number_of_channels ; i ++ ) {
92
- test_table [i ] = channel = tr51_get_uc_channel_index (i , mac , number_of_channels , NULL );
95
+ test_table [i ] = channel = tr51_get_uc_channel_index (channel_table , i , mac , number_of_channels , NULL );
93
96
// Not sure yet which one is correct since there might be bug in spec
94
97
// if (channel != test_HopSequenceTable[i]) {
95
98
if (channel != test_HopSequenceTable2 [i ]) {
@@ -114,7 +117,7 @@ bool test_tr51_get_uc_channel_index()
114
117
uint32_t excluded_channels [8 ] = {0x40100401 , 0x10040100 , 0x04010040 , 0 , 0 , 0 , 0 , 0 };
115
118
uint16_t number_of_excluded_channels = 10 ;
116
119
for (i = 0 ; i < number_of_channels - number_of_excluded_channels ; i ++ ) {
117
- test_table [i ] = channel = tr51_get_uc_channel_index (i , mac , number_of_channels , excluded_channels );
120
+ test_table [i ] = channel = tr51_get_uc_channel_index (channel_table , i , mac , number_of_channels , excluded_channels );
118
121
// Shouldn't find channel from excluded channels
119
122
if (channel_on_the_list (excluded_channels , channel )) {
120
123
return false;
@@ -137,8 +140,10 @@ bool test_tr51_get_bc_channel_index()
137
140
int32_t channel ;
138
141
uint16_t bsi = 100 ;
139
142
int32_t test_table [number_of_channels ];
143
+ int16_t channel_table [number_of_channels ];
144
+ tr51_init_channel_table (channel_table , number_of_channels );
140
145
for (int i = 0 ; i < number_of_channels ; i ++ ) {
141
- test_table [i ] = channel = tr51_get_bc_channel_index (i , bsi , number_of_channels , NULL );
146
+ test_table [i ] = channel = tr51_get_bc_channel_index (channel_table , i , bsi , number_of_channels , NULL );
142
147
if (channel != test_HopSequenceTable3 [i ]) {
143
148
return false;
144
149
}
0 commit comments