@@ -650,6 +650,26 @@ static void test_6ghz_freqs(const void *data)
}
}
+static void test_conversions(const void *data)
+{
+ /*
+ * Test a few invalid channels/frequencies that appear valid but are
+ * not in the E-4 table. The checks in band.c seem to cover 2.4Ghz and
+ * 6Ghz very well since there are no gaps, but the 5GHz band has some
+ * segmentation.
+ */
+
+ /* Gap in 5GHz channels between 68 and 96 */
+ assert(!band_channel_to_freq(72, BAND_FREQ_5_GHZ));
+ assert(!band_freq_to_channel(5360, NULL));
+
+ /* Invalid channel using 4000mhz starting frequency */
+ assert(!band_channel_to_freq(183, BAND_FREQ_5_GHZ));
+ assert(!band_freq_to_channel(4915, NULL));
+
+ assert(!band_channel_to_freq(192, BAND_FREQ_5_GHZ));
+}
+
int main(int argc, char *argv[])
{
l_test_init(&argc, &argv);
@@ -715,5 +735,7 @@ int main(int argc, char *argv[])
l_test_add("/band/6ghz/channels", test_6ghz_channels, NULL);
l_test_add("/band/6ghz/freq", test_6ghz_freqs, NULL);
+ l_test_add("/band/conversions", test_conversions, NULL);
+
return l_test_run();
}