spiegel-keyman/core/tests/unit/ldml
Steven R. Loomis 75fcc5f3fe chore(core): regex cleanup 🙀
- cache the icu::RegexPattern
- rename USet to avoid a conflict with the real one!

For: #9121
2023-08-10 18:35:06 -05:00
..
invalid-keyboards chore(core): add unit test for zero checksum 2022-09-12 05:46:13 +10:00
keyboards feat(core): regex apply-side 🙀 2023-08-09 18:08:25 -05:00
ldml.cpp Merge branch 'master' into feat/core-8435-repertoire-test-epic-ldml 2023-04-11 19:06:02 -05:00
ldml_test_source.cpp chore(core): regex cleanup 🙀 2023-08-10 18:35:06 -05:00
ldml_test_source.hpp feat(core): ldml repertoire test 🙀 2023-03-16 15:49:00 -05:00
ldml_test_utils.cpp feat(core): ldml repertoire test 🙀 2023-03-16 14:28:51 -05:00
ldml_test_utils.hpp feat(core): ldml repertoire test 🙀 2023-03-16 14:28:51 -05:00
meson.build feat(core): regex 🙀 2023-08-09 16:27:56 -05:00
README.md feat(core): ldml unit tests and stub actions 2022-08-07 08:02:50 -05:00
test_kmx_plus.cpp chore(core): regex cleanup 🙀 2023-08-10 18:35:06 -05:00
test_transforms.cpp chore(core): regex cleanup 🙀 2023-08-10 18:35:06 -05:00

LDML unit tests

This directory contains unit tests that test the LDML keyboard processing.

The driver (ldml.cpp) loads and executes the tests. Each test consist of a Keyman keyboard source file (*.xml) and the compiled KMXPlus keyboard. The source file contains rules and defines the setup, input and expected results.

Defining tests in the .xml file

Somewhere near the top of the file, an XML comment contains lines that define the setup, input and expected results.

Setup

  • description: this is just for commenting what we test here
@@description: Tests Caps Lock env set
  • capsLock: allows to set the caps lock state. The example below turns caps-lock on at the start of the test. [K_CAPS] in the keys comment allows toggling of caps lock.
@@capsLock: 1
  • context: allows to setup a string which serves as context
@@context:

Input

  • keys: defines one or more virtual keys that will be processed one after the other
@@keys: [K_1][K_CAPS][K_2][SHIFT K_3][K_4][K_CAPS][K_5][K_CAPS][K_6]

Expected Result

  • expected: the resulting string of processing the input keys. In the example below each key press is expected to output the string 'pass.'.
@@expected: pass.pass.pass.pass.pass.pass.

Running the tests

All tests can be run at once with ./build.sh --debug tests.

Alternatively it's possible to run a single test with:

cd core
build/arch/debug/tests/unit/ldml/ldml 'tests/unit/ldml/000_test_zero.xml' 'tests/unit/ldml/000_test_zero.kmx'