<commit_before>; Test runner for kernel unit tests

;Uncomment to automatically run the specified test
.equ defaultTest 0x0007

;Uncomment to add a jr $ before running tests
;#define BREAK_BEFORE_TEST

; To create a new unit test:
; 1. Create a file for it in tests/ (if needed)
; 2. Add the test function
;    Return test success in A (0: Pass | 1: Fail)
; 3. Add test to test_collection
test_collection:
    .dw test_hexToA         ; 0000 test_hexToA
    .dw test_cpHLDE         ; 0001 test_cpHLDE
    .dw test_cpHLBC         ; 0002 test_cpHLBC
    .dw test_cpBCDE         ; 0003 test_cpBCDE
    .dw test_stringLength   ; 0004 test_stringLength
    .dw test_DEMulA         ; 0005 test_DEMulA
    .dw test_compareStrings ; 0006 test_compareStrings

    .dw test_openFileRead   ; 0007 test_openFileRead

    .dw 0xFFFF
explicit_only:
    ; Tests here are only run when explicity mentioned by number
test_collection_end:

testrunner:
    call getLcdLock
    call allocScreenBuffer
#ifdef defaultTest
    call clearBuffer
    ld hl, defaultTest * 2
    ld bc, test_collection
    or a
    adc hl, bc
    ld bc, defaultTest * 2
    ld e, (hl)
    inc hl
    ld d, (hl)
    dec hl
    ex de, hl
    jp testrunner_runtest<commit_msg>Got keypad lock in test runner<commit_after>; Test runner for kernel unit tests

;Uncomment to automatically run the specified test
;.equ defaultTest 0x0007

;Uncomment to add a jr $ before running tests
;#define BREAK_BEFORE_TEST

; To create a new unit test:
; 1. Create a file for it in tests/ (if needed)
; 2. Add the test function
;    Return test success in A (0: Pass | 1: Fail)
; 3. Add test to test_collection
test_collection:
    .dw test_hexToA         ; 0000 test_hexToA
    .dw test_cpHLDE         ; 0001 test_cpHLDE
    .dw test_cpHLBC         ; 0002 test_cpHLBC
    .dw test_cpBCDE         ; 0003 test_cpBCDE
    .dw test_stringLength   ; 0004 test_stringLength
    .dw test_DEMulA         ; 0005 test_DEMulA
    .dw test_compareStrings ; 0006 test_compareStrings

    .dw test_openFileRead   ; 0007 test_openFileRead

    .dw 0xFFFF
explicit_only:
    ; Tests here are only run when explicity mentioned by number
test_collection_end:

testrunner:
    call getLcdLock
    call getKeypadLock
    call allocScreenBuffer
#ifdef defaultTest
    call clearBuffer
    ld hl, defaultTest * 2
    ld bc, test_collection
    or a
    adc hl, bc
    ld bc, defaultTest * 2
    ld e, (hl)
    inc hl
    ld d, (hl)
    dec hl
    ex de, hl
    jp testrunner_runtest
{'fraction_non_alphanumeric': 0.050861033239887866, 'fraction_numerical': 0.03604325190228274, 'mean_word_length': 2.728358208955224, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3999226', 'n_tokens_mistral': 920, 'n_tokens_neox': 830, 'n_words': 304}