Get keymap tests to pass (issues [#23] and [#25])

Clean compile of asdf_keymaps.c/h and tests

Clean up keymap pointer notation

Reduce number of keymaps to 16, matching number of DIP switches allocated for
keymap selection.
This commit is contained in:
Dave 2021-02-20 00:01:07 -06:00 committed by Dave
parent 14ad7c4cc2
commit bcde21f3a8
6 changed files with 85 additions and 109 deletions

View File

@ -50,7 +50,7 @@
// Data structure sizes:
// Max number of keymaps supported (defines size of keymap setup routine array)
#define ASDF_NUM_KEYMAPS 32
#define ASDF_NUM_KEYMAPS 16
// Size of keymap initializer sequence. These sequences are defined in the
// keymap modules. This should be large enough to accommodate the largest

View File

@ -31,11 +31,8 @@
#include "asdf_keymaps.h"
#include "asdf_modifiers.h"
// The keymap arrays organized as follows:
// * keymap_matrix - matrix of code mapppings for each physical keymap
// * rows = number of rows in the matrix
// * cols = number of cols in the matrix
// * one map structure for each modifier state.
// The keymap array contains the keymap information for each modifier state
// This structure is populated using the asdf_keymaps_add_map() function.
static asdf_keycode_map_t keymaps[ASDF_MOD_NUM_MODIFIERS] = {};
// List of keymap setup routines. Each keymap setup routine is responsible for
@ -74,7 +71,7 @@ void asdf_keymaps_register(uint8_t keymap_index, asdf_keymap_setup_function_t ke
}
// PROCEDURE: asdf_keymaps_add_map
// INPUTS: (asdf_keycode_matrix_t) matrix - pointer to the keycode matrix to add in to map
// INPUTS: (asdf_keycode_t *) - pointer to the keycode matrix to add in to map
// (uint8_t) modifier_index - the modifier value for the keycode matrix being added
// (uint8_t) rows - number of rows in the keymap
// (uint8_t) cols - number of columns in the keymap
@ -92,7 +89,7 @@ void asdf_keymaps_register(uint8_t keymap_index, asdf_keymap_setup_function_t ke
// SCOPE: public
//
// COMPLEXITY: 1
void asdf_keymaps_add_map(asdf_keycode_matrix_t matrix,
void asdf_keymaps_add_map(const asdf_keycode_t *matrix,
modifier_index_t modifier_index,
uint8_t num_rows, uint8_t num_cols)
{
@ -100,7 +97,7 @@ void asdf_keymaps_add_map(asdf_keycode_matrix_t matrix,
&& (num_rows <= ASDF_MAX_ROWS)
&& (num_cols <= ASDF_MAX_COLS))
{
keymaps[modifier_index].matrix_ptr = matrix;
keymaps[modifier_index].matrix = (asdf_keycode_t *) matrix;
keymaps[modifier_index].rows = num_rows;
keymaps[modifier_index].cols = num_cols;
}
@ -145,7 +142,7 @@ uint8_t asdf_keymaps_num_cols(void)
}
// PROCEDURE: asdf_keymaps_new
// PROCEDURE: asdf_keymaps_clear
// INPUTS: none
// OUTPUTS: none
//
@ -157,14 +154,14 @@ uint8_t asdf_keymaps_num_cols(void)
//
// COMPLEXITY: 2
//
static void asdf_keymaps_new(void)
static void asdf_keymaps_clear(void)
{
for (uint8_t i = 0; i < ASDF_MOD_NUM_MODIFIERS; i++) {
asdf_keymaps_add_map(NULL, i, 0, 0);
}
}
// PROCEDURE: asdf_keymaps_select_keymap
// PROCEDURE: asdf_keymaps_select
// INPUTS: (uint8_t) index - index of the keymap number to select
// OUTPUTS: none
//
@ -183,11 +180,11 @@ static void asdf_keymaps_new(void)
//
// COMPLEXITY: 2
//
void asdf_keymaps_select_keymap(uint8_t index)
void asdf_keymaps_select(uint8_t index)
{
if (index < ASDF_NUM_KEYMAPS) {
asdf_arch_init();
asdf_keymaps_new();
asdf_keymaps_clear();
current_keymap_index = index;
keymap_setup_function_lookup_table[index]();
}
@ -246,7 +243,7 @@ void asdf_keymaps_init(void)
//
void asdf_keymaps_map_select_0_clear(void)
{
asdf_keymaps_select_keymap(current_keymap_index & (~ASDF_KEYMAP_BIT_0));
asdf_keymaps_select(current_keymap_index & (~ASDF_KEYMAP_BIT_0));
}
// PROCEDURE: asdf_keymaps_map_select_0_set
@ -266,7 +263,7 @@ void asdf_keymaps_map_select_0_clear(void)
//
void asdf_keymaps_map_select_0_set(void)
{
asdf_keymaps_select_keymap(current_keymap_index | ASDF_KEYMAP_BIT_0);
asdf_keymaps_select(current_keymap_index | ASDF_KEYMAP_BIT_0);
}
// PROCEDURE: asdf_keymaps_map_select_1_clear
@ -286,7 +283,7 @@ void asdf_keymaps_map_select_0_set(void)
//
void asdf_keymaps_map_select_1_clear(void)
{
asdf_keymaps_select_keymap(current_keymap_index & (~ASDF_KEYMAP_BIT_1));
asdf_keymaps_select(current_keymap_index & (~ASDF_KEYMAP_BIT_1));
}
// PROCEDURE: asdf_keymaps_map_select_1_set
@ -306,7 +303,7 @@ void asdf_keymaps_map_select_1_clear(void)
//
void asdf_keymaps_map_select_1_set(void)
{
asdf_keymaps_select_keymap(current_keymap_index | ASDF_KEYMAP_BIT_1);
asdf_keymaps_select(current_keymap_index | ASDF_KEYMAP_BIT_1);
}
// PROCEDURE: asdf_keymaps_map_select_2_clear
@ -326,7 +323,7 @@ void asdf_keymaps_map_select_1_set(void)
//
void asdf_keymaps_map_select_2_clear(void)
{
asdf_keymaps_select_keymap(current_keymap_index & (~ASDF_KEYMAP_BIT_2));
asdf_keymaps_select(current_keymap_index & (~ASDF_KEYMAP_BIT_2));
}
// PROCEDURE: asdf_keymaps_map_select_2_set
@ -346,7 +343,7 @@ void asdf_keymaps_map_select_2_clear(void)
//
void asdf_keymaps_map_select_2_set(void)
{
asdf_keymaps_select_keymap(current_keymap_index | ASDF_KEYMAP_BIT_2);
asdf_keymaps_select(current_keymap_index | ASDF_KEYMAP_BIT_2);
}
// PROCEDURE: asdf_keymaps_map_select_3_clear
@ -366,7 +363,7 @@ void asdf_keymaps_map_select_2_set(void)
//
void asdf_keymaps_map_select_3_clear(void)
{
asdf_keymaps_select_keymap(current_keymap_index & (~ASDF_KEYMAP_BIT_3));
asdf_keymaps_select(current_keymap_index & (~ASDF_KEYMAP_BIT_3));
}
// PROCEDURE: asdf_keymaps_map_select_3_set
@ -386,7 +383,7 @@ void asdf_keymaps_map_select_3_clear(void)
//
void asdf_keymaps_map_select_3_set(void)
{
asdf_keymaps_select_keymap(current_keymap_index | ASDF_KEYMAP_BIT_3);
asdf_keymaps_select(current_keymap_index | ASDF_KEYMAP_BIT_3);
}
// PROCEDURE: asdf_keymaps_get_code
@ -409,8 +406,14 @@ void asdf_keymaps_map_select_3_set(void)
asdf_keycode_t asdf_keymaps_get_code(const uint8_t row, const uint8_t col,
const uint8_t modifier_index)
{
asdf_keycode_matrix_t matrix = keymaps[modifier_index].matrix_ptr;
return FLASH_READ_MATRIX_ELEMENT(matrix, row, col);
uint8_t num_cols = keymaps[current_keymap_index].cols;
asdf_keycode_t keycode = 0;
if (keymaps[current_keymap_index].cols && keymaps[current_keymap_index].rows) {
asdf_keycode_t (*keycode_matrix)[num_cols] = (void *) (keymaps[modifier_index].matrix);
keycode = FLASH_READ_MATRIX_ELEMENT(keycode_matrix, row, col);
}
return keycode;
}
//-------|---------|---------+---------+---------+---------+---------+---------+

View File

@ -45,10 +45,6 @@
#define ASDF_MAX_ROWS 16
#define ASDF_MAX_COLS 8
// define the keycode matrices to be used by the keymaps. Each matrix is a
// mapping of row,column to keycode.
typedef asdf_keycode_t **asdf_keycode_matrix_t;
// define the type for a keymap setup function. Keymaps are registerd by storing
// a keymap setup function in the keymap setup array.
typedef void (*asdf_keymap_setup_function_t)(void);
@ -56,7 +52,7 @@ typedef void (*asdf_keymap_setup_function_t)(void);
// define the struct for each keymap matrix in the keymap array. One per
// modifier state. Each keymap can have it's own row and column count.
typedef struct {
asdf_keycode_matrix_t matrix_ptr;
asdf_keycode_t *matrix;
uint8_t rows;
uint8_t cols;
} asdf_keycode_map_t;
@ -74,7 +70,7 @@ typedef struct {
void asdf_keymaps_register(uint8_t keymap_index, asdf_keymap_setup_function_t keymap_setup_function);
// PROCEDURE: asdf_keymaps_add_map
// INPUTS: (asdf_keycode_matrix_t *) matrix - pointer to the keycode matrix to add in to map
// INPUTS: (asdf_keycode_t *) matrix - pointer to the keycode matrix to add in to map
// (uint8_t) modifier_index - the modifier value for the keycode matrix being added
// (uint8_t) rows - number of rows in the keymap
// (uint8_t) cols - number of columns in the keymap
@ -83,7 +79,7 @@ void asdf_keymaps_register(uint8_t keymap_index, asdf_keymap_setup_function_t ke
// setup function into the keymap setup array.
// NOTES: If the keymap modifier index, num_rows, or num_cols are not valid then no
// action is performed.
void asdf_keymaps_add_map(asdf_keycode_matrix_t matrix,
void asdf_keymaps_add_map(const asdf_keycode_t *matrix,
modifier_index_t modifier_index,
uint8_t num_rows, uint8_t num_cols);
@ -99,13 +95,13 @@ uint8_t asdf_keymaps_num_rows(void);
// DESCRIPTION: See OUTPUTS
uint8_t asdf_keymaps_num_cols(void);
// PROCEDURE: asdf_keymaps_select_keymap
// PROCEDURE: asdf_keymaps_select
// INPUTS: (uint8_t) index - index of the keymap number to select
// OUTPUTS: none
// DESCRIPTION: accepts a index value. If the requested keymap index is valid,
// then assign the value to the global (to the module) keymap_index variable. If
// requested index is not valid then do nothing.
void asdf_keymaps_select_keymap(uint8_t index);
void asdf_keymaps_select(uint8_t index);
// PROCEDURE: asdf_keymaps_map_select_0_clear
// INPUTS: none

View File

@ -56,43 +56,43 @@ static const asdf_keycode_t test2_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = AS
//
void test_keymaps_add_map(asdf_keycode_matrix_t matrix,
modifier_index_t modifier_index)
void test_keymaps_add_map (const asdf_keycode_t (*matrix)[TEST_NUM_COLS],
modifier_index_t modifier_index)
{
asdf_keymaps_add_map(matrix, modifier_index, (uint8_t) TEST_NUM_ROWS, (uint8_t) TEST_NUM_COLS);
asdf_keymaps_add_map(&matrix[0][0], modifier_index, (uint8_t) TEST_NUM_ROWS, (uint8_t) TEST_NUM_COLS);
}
void setup_test_plain_map(void)
{
test_keymaps_add_map((asdf_keycode_matrix_t) test_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test_CTRL_matrix, MOD_CTRL_MAP);
test_keymaps_add_map(&test_PLAIN_matrix[0], MOD_PLAIN_MAP);
test_keymaps_add_map(test_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test_caps_map(void)
{
test_keymaps_add_map((asdf_keycode_matrix_t) test_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test_CTRL_matrix, MOD_CTRL_MAP);
test_keymaps_add_map(test_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map(test_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test2_plain_map(void)
{
test_keymaps_add_map((asdf_keycode_matrix_t) test2_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test2_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test2_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test2_CTRL_matrix, MOD_CTRL_MAP);
test_keymaps_add_map(test2_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map(test2_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test2_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test2_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test2_caps_map(void)
{
test_keymaps_add_map((asdf_keycode_matrix_t) test2_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test2_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test2_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map((asdf_keycode_matrix_t) test2_CTRL_matrix, MOD_CTRL_MAP);
test_keymaps_add_map(test2_PLAIN_matrix, MOD_PLAIN_MAP);
test_keymaps_add_map(test2_CAPS_matrix, MOD_CAPS_MAP);
test_keymaps_add_map(test2_SHIFT_matrix, MOD_SHIFT_MAP);
test_keymaps_add_map(test2_CTRL_matrix, MOD_CTRL_MAP);
}
void setup_test_devs1(void)

View File

@ -129,8 +129,6 @@
#define ASDF_TEST_KEYMAPS ASDF_TEST_MAP_DEFS, ASDF_TEST_CAPS_MAP_DEFS
#define ASDF_TEST_PLAIN_MAP_INDEX 0
#define ASDF_TEST_CAPS_MAP_INDEX 1
@ -248,19 +246,6 @@
}
#define ASDF_TEST2_DECLARATIONS \
#define ASDF_TEST2_MAP_DEFS \
{ \
&test2_PLAIN_matrix, &test2_SHIFT_matrix, &test2_CAPS_matrix, &test2_CTRL_matrix \
}
#define ASDF_TEST2_CAPS_MAP_DEFS \
{ \
&test2_CAPS_matrix, &test2_SHIFT_matrix, &test2_CAPS_matrix, &test2_CTRL_matrix \
}
#define ASDF_TEST2_KEYMAPS ASDF_TEST2_MAP_DEFS, ASDF_TEST2_CAPS_MAP_DEFS
#define ASDF_TEST2_PLAIN_MAP_INDEX 2
#define ASDF_TEST2_CAPS_MAP_INDEX 3

View File

@ -14,15 +14,23 @@
#define TESTKEYMAP_TAG PLAIN_MATRIX_1
#define NUM_DIPSWITCHES 4
static const FLASH asdf_keycode_t test_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_PLAIN_MAP;
static const FLASH asdf_keycode_t test_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_SHIFT_MAP;
static const FLASH asdf_keycode_t test_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_CAPS_MAP;
static const FLASH asdf_keycode_t test_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST_CTRL_MAP;
static const FLASH asdf_keycode_t test_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_PLAIN_MAP;
static const FLASH asdf_keycode_t test_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_SHIFT_MAP;
static const FLASH asdf_keycode_t test_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_CAPS_MAP;
static const FLASH asdf_keycode_t test_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST_CTRL_MAP;
static const FLASH asdf_keycode_t test2_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_PLAIN_MAP;
static const FLASH asdf_keycode_t test2_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_SHIFT_MAP;
static const FLASH asdf_keycode_t test2_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_CAPS_MAP;
static const FLASH asdf_keycode_t test2_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] = ASDF_TEST2_CTRL_MAP;
static const FLASH asdf_keycode_t test2_PLAIN_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_PLAIN_MAP;
static const FLASH asdf_keycode_t test2_SHIFT_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_SHIFT_MAP;
static const FLASH asdf_keycode_t test2_CAPS_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_CAPS_MAP;
static const FLASH asdf_keycode_t test2_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS] =
ASDF_TEST2_CTRL_MAP;
// row: row number
// col: column number
@ -32,7 +40,7 @@ static const FLASH asdf_keycode_t test2_CTRL_matrix[TEST_NUM_ROWS][TEST_NUM_COLS
// modifier_name: name of the modifier to be accessed within the map.
#define TESTMAP(row, col, keymap_name, defnum, mapindex, modifier_name) \
do { \
asdf_keymaps_select_keymap(ASDF_##mapindex##_MAP_INDEX); \
asdf_keymaps_select(ASDF_##mapindex##_MAP_INDEX); \
asdf_keycode_t expected = keymap_name##_##modifier_name##_matrix[(row)][(col)]; \
asdf_keycode_t result = asdf_keymaps_get_code((row), (col), MOD_##modifier_name##_MAP); \
asdf_keycode_t map_id = asdf_keymaps_get_code(0, 0, MOD_##modifier_name##_MAP); \
@ -113,11 +121,6 @@ void setUp(void)
{
coord_t *temp;
setup_test_plain_map();
setup_test_caps_map();
setup_test2_plain_map();
setup_test2_caps_map();
asdf_keymaps_init();
temp = find_code(TESTALPHA);
@ -129,11 +132,10 @@ void setUp(void)
temp = find_code(TESTKEYMAP_TAG);
keymap_tag = *temp;
setup_test_plain_map();
setup_test_caps_map();
setup_test2_plain_map();
setup_test2_caps_map();
asdf_keymaps_register(ASDF_TEST_PLAIN_MAP_INDEX, &setup_test_plain_map);
asdf_keymaps_register(ASDF_TEST_CAPS_MAP_INDEX, &setup_test_caps_map);
asdf_keymaps_register(ASDF_TEST2_PLAIN_MAP_INDEX, &setup_test2_plain_map);
asdf_keymaps_register(ASDF_TEST2_CAPS_MAP_INDEX, &setup_test2_caps_map);
}
void tearDown(void) {}
@ -162,7 +164,7 @@ void complicated_set_keymap(uint8_t mapnum)
// dummy function, to resolve reference in keymap hook initialization.
asdf_cols_t asdf_arch_read_row(uint8_t row)
{
return (asdf_cols_t) (row+1);
return (asdf_cols_t)(row + 1);
}
void test_chars_are_in_map(void)
@ -173,6 +175,9 @@ void test_chars_are_in_map(void)
void keymap0_plain_gives_plain_values(void)
{
asdf_keymaps_select(ASDF_TEST_PLAIN_MAP_INDEX);
TEST0PLAIN(alpha_sample.row, alpha_sample.col);
TEST0PLAIN(num_sample.row, num_sample.col);
}
@ -252,20 +257,14 @@ void dip_switch_codes_are_in_last_row_test2_map(void)
void dip_switch_properly_sets_bits(void)
{
char message[80];
sprintf(message, "Map 0 is %d.", PLAIN_MATRIX_1);
TEST_MESSAGE(message);
for (uint8_t i = 0; i < ASDF_NUM_KEYMAPS; i++) {
asdf_keycode_t expected;
asdf_keycode_t result;
asdf_keymaps_select_keymap(i);
asdf_keymaps_select(i);
expected = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
// set all keymap bits to '0'
asdf_keymaps_select_keymap(0);
asdf_keymaps_select(0);
complicated_set_keymap(i);
result = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
@ -278,12 +277,7 @@ void dip_switch_properly_clears_bits(void)
{
uint8_t mask = 0;
uint8_t next = 1;
char message[80];
sprintf(message, "Map 0 is %d.", PLAIN_MATRIX_1);
TEST_MESSAGE(message);
// calculate word with most 1's less than (or equal to) ASDF_NUM_KEYMAPS
while (next < ASDF_NUM_KEYMAPS) {
mask = next;
@ -292,12 +286,11 @@ void dip_switch_properly_clears_bits(void)
for (uint8_t i = 0; i < ASDF_NUM_KEYMAPS; i++) {
asdf_keycode_t expected;
asdf_keycode_t result;
asdf_keymaps_select_keymap(i);
asdf_keymaps_select(i);
expected = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
sprintf(message,"map %d, expected: %d",i, expected);
TEST_MESSAGE(message);
// set as many keymap bits to '1' as possible.
asdf_keymaps_select_keymap(mask);
asdf_keymaps_select(mask);
complicated_set_keymap(i);
result = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(expected, result);
@ -310,25 +303,24 @@ void dip_switch_invalid_keymap_has_no_effect(void)
asdf_keycode_t map_id;
// First, assert that changing to matrix 2 works:
asdf_keymaps_select_keymap(ASDF_TEST2_PLAIN_MAP_INDEX);
asdf_keymaps_select(ASDF_TEST2_PLAIN_MAP_INDEX);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_2, map_id);
// assert that resetting keymap to 0 works:
asdf_keymaps_select_keymap(0);
asdf_keymaps_select(0);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_1, map_id);
// selecting one above the highest keymap should have no effect
asdf_keymaps_select_keymap(ASDF_NUM_KEYMAPS);
asdf_keymaps_select(ASDF_NUM_KEYMAPS);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_1, map_id);
// selecting the highest possible keymap should have no effect
asdf_keymaps_select_keymap(UINT8_MAX);
asdf_keymaps_select(UINT8_MAX);
map_id = asdf_keymaps_get_code(keymap_tag.row, keymap_tag.col, MOD_PLAIN_MAP);
TEST_ASSERT_EQUAL_INT32(PLAIN_MATRIX_1, map_id);
}
int main(void)