unit: Add OCI verification test

This commit is contained in:
Denis Kenzior 2021-09-21 15:07:59 -05:00
parent b41106d359
commit 764376b677
1 changed files with 25 additions and 0 deletions

View File

@ -306,6 +306,29 @@ static void test_oci2freq(const void *data)
assert(r == test->expected_freq);
}
static const struct band_chandef cd_1 = {
.frequency = 5540,
.channel_width = BAND_CHANDEF_WIDTH_160,
.center1_frequency = 5570,
};
struct oci_data {
const struct band_chandef *cd;
uint8_t oci[3];
int expected_verify_error;
};
static const struct oci_data oci_data_1 = { &cd_1, { 129, 108, 0 } };
static void test_oci_verify(const void *data)
{
const struct oci_data *test = data;
int r;
r = oci_verify(test->oci, test->cd);
assert(r == test->expected_verify_error);
}
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@ -325,5 +348,7 @@ int main(int argc, char *argv[])
l_test_add("/band/oci2freq 7", test_oci2freq, &oci2freq_data_7);
l_test_add("/band/oci2freq 8", test_oci2freq, &oci2freq_data_8);
l_test_add("/band/oci/verify 1", test_oci_verify, &oci_data_1);
return l_test_run();
}