From 764376b677fad68611f29f0ac97db6ff28d96566 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 21 Sep 2021 15:07:59 -0500 Subject: [PATCH] unit: Add OCI verification test --- unit/test-band.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/unit/test-band.c b/unit/test-band.c index 45c67ab6..1b020eea 100644 --- a/unit/test-band.c +++ b/unit/test-band.c @@ -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(); }