-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new tests, and fix the layer functions
- Loading branch information
1 parent
f7c76d4
commit 5c100cf
Showing
9 changed files
with
327 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "squirrel.h" | ||
#include "squirrel_consumer.h" | ||
#include "squirrel_key.h" | ||
#include "squirrel_quantum.h" | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
// test: consumer_activate_consumer_code + consumer_deactivate_consumer_code + | ||
// consumer_get_consumer_code - in squirrel_consumer.c | ||
int main() { | ||
for (uint16_t test_consumer_code = 0; test_consumer_code <= 65534; | ||
test_consumer_code++) { | ||
// consumer_activate_consumer_code | ||
consumer_activate_consumer_code(test_consumer_code); | ||
if (consumer_get_consumer_code() != test_consumer_code) { | ||
return 1; | ||
} | ||
// consumer_deactivate_consumer_code | ||
consumer_deactivate_consumer_code(test_consumer_code); | ||
if (consumer_get_consumer_code() != 0) { | ||
return 2; | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "squirrel.h" | ||
#include "squirrel_consumer.h" | ||
#include "squirrel_key.h" | ||
#include "squirrel_quantum.h" | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
// test: keyboard_activate_modifier + keyboard_deactivate_modifier + | ||
// keyboard_get_modifiers - in squirrel_keyboard.c | ||
int main() { | ||
for (uint8_t test_modifier = 0b00000001; test_modifier != 0b00000000; | ||
test_modifier = test_modifier << 1) { | ||
for (uint8_t test_modifier_2 = 0b10000000; test_modifier_2 != 0b00000000; | ||
test_modifier_2 = test_modifier_2 >> 1) { | ||
if (test_modifier == test_modifier_2) { // Skip if the same modifier | ||
continue; | ||
} | ||
keyboard_activate_modifier(test_modifier); | ||
if (keyboard_get_modifiers() != test_modifier) { | ||
return 1; | ||
} | ||
keyboard_activate_modifier(test_modifier_2); | ||
if (keyboard_get_modifiers() != (test_modifier | test_modifier_2)) { | ||
return 2; | ||
} | ||
// keyboard_deactivate_modifier | ||
keyboard_deactivate_modifier(test_modifier); | ||
if (keyboard_get_modifiers() != test_modifier_2) { | ||
return 3; | ||
} | ||
keyboard_deactivate_modifier(test_modifier_2); | ||
if (keyboard_get_modifiers() != 0) { | ||
return 4; | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "squirrel.h" | ||
#include "squirrel_consumer.h" | ||
#include "squirrel_key.h" | ||
#include "squirrel_quantum.h" | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
|
||
// test: keyboard_activate_keycode + keyboard_deactivate_keycode in | ||
// squirrel_keyboard.c | ||
int main() { | ||
for (uint8_t test_keycode = 0; test_keycode <= 254; test_keycode++) { | ||
// keyboard_activate_keycode | ||
keyboard_activate_keycode(test_keycode); | ||
if (keyboard_keycodes[test_keycode] != true) { | ||
return 1; | ||
} | ||
// keyboard_deactivate_keycode | ||
keyboard_deactivate_keycode(test_keycode); | ||
if (keyboard_keycodes[test_keycode] != false) { | ||
return 2; | ||
} | ||
} | ||
}; |
Oops, something went wrong.