xref: /linux/drivers/net/wireless/intel/iwlwifi/mvm/tests/hcmd.c (revision 1b98f357dadd6ea613a435fbaef1a5dd7b35fd21)
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /*
3  * KUnit tests for channel helper functions
4  *
5  * Copyright (C) 2025 Intel Corporation
6  */
7 #include <kunit/test.h>
8 
9 #include <iwl-trans.h>
10 #include "../mvm.h"
11 
12 MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
13 
14 static void test_hcmd_names_sorted(struct kunit *test)
15 {
16 	for (int i = 0; i < iwl_mvm_groups_size; i++) {
17 		const struct iwl_hcmd_arr *arr = &iwl_mvm_groups[i];
18 
19 		if (!arr->arr)
20 			continue;
21 
22 		for (int j = 0; j < arr->size - 1; j++)
23 			KUNIT_EXPECT_LE(test, arr->arr[j].cmd_id,
24 					arr->arr[j + 1].cmd_id);
25 	}
26 }
27 
28 static struct kunit_case hcmd_names_cases[] = {
29 	KUNIT_CASE(test_hcmd_names_sorted),
30 	{},
31 };
32 
33 static struct kunit_suite hcmd_names = {
34 	.name = "iwlmvm-hcmd-names",
35 	.test_cases = hcmd_names_cases,
36 };
37 
38 kunit_test_suite(hcmd_names);
39