Skip to content

Commit

Permalink
feat: add tests for layer_press_release
Browse files Browse the repository at this point in the history
  • Loading branch information
headblockhead committed Aug 21, 2024
1 parent f318b5a commit f7c76d4
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions tests/layer_press_release.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,85 @@ int main() {
void **args = malloc(sizeof(void *));
uint8_t target_layer = 1;
args[0] = &target_layer;

// layer_momentary
layer_momentary_press(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 7;
}
}
if (!layers[target_layer].active) {
return 8;
}
layer_momentary_release(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 9;
}
}
if (layers[target_layer].active) {
return 10;
}

// layer_toggle
layer_toggle_press(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 11;
}
}
if (!layers[target_layer].active) {
return 12;
}
layer_toggle_press(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 13;
}
}
if (!layers[target_layer].active) {
return 14;
}
layer_toggle_release(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 15;
}
}
if (!layers[target_layer].active) {
return 16;
}
layers[target_layer].active = false;

// layer_turn_on
layer_turn_on_press(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 17;
}
}
if (!layers[target_layer].active) {
return 18;
}
layer_turn_on_press(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 19;
}
}
if (!layers[target_layer].active) {
return 20;
}
layer_turn_on_release(&test_key, 0, 0, 1, args);
for (uint8_t i = 0; i < 17; i++) {
if (layers[i].active && i != target_layer) {
return 21;
}
}
if (!layers[target_layer].active) {
return 22;
}
free(args);

return 0;
Expand Down

0 comments on commit f7c76d4

Please sign in to comment.